Advertisement
Everath

Untitled

Apr 5th, 2020
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function resizePage(id) {
  2.         var doc_width = jQuery(document).width();
  3.         var page_width = parseInt(pages[id].width);
  4.         var page_height = parseInt(pages[id].height);
  5.         var nice_width = 980;
  6.         var perfect_width = 980;
  7.        
  8.         if(doc_width > 1200) {
  9.             nice_width = 1120;
  10.             perfect_width = 1000;
  11.         }
  12.         if(doc_width > 1600) {
  13.             nice_width = 1400;
  14.             perfect_width = 1300;
  15.         }
  16.         if(doc_width > 1800) {
  17.             nice_width = 1600;
  18.             perfect_width = 1500;
  19.         }
  20.         if(doc_width > 2400) {
  21.             nice_width = 2200;
  22.             perfect_width = 2100;
  23.         }
  24.        
  25.        
  26.         if (page_width > nice_width && (page_width/page_height) > 1.2) {
  27.             if(page_height < 1610) {
  28.                 width = page_width;
  29.                 height = page_height;
  30.             }
  31.             else {
  32.                 height = 1600;
  33.                 width = page_width;
  34.                 width = (height*width)/(page_height);
  35.             }
  36.             jQuery("#page").css({'max-width': 'none', 'overflow':'auto'});
  37.             jQuery("#page").animate({scrollLeft:9000},400);
  38.             jQuery('#page .inner .preview img').attr({width:width, height:height});
  39.             jQuery("#page .inner img.open").css({'max-width':'99999px'});
  40.             jQuery('#page .inner img.open').attr({width:width, height:height});
  41.             if(jQuery("#page").width() < jQuery("#page .inner img.open").width()) {
  42.                 isSpread = true;
  43.                 create_message('is_spread', 3000, 'Tap the arrows twice to change page');
  44.             }
  45.             else {
  46.                 jQuery("#page").css({'max-width': width+10, 'overflow':'auto'});
  47.                 isSpread = false;
  48.                 delete_message('is_spread');
  49.             }
  50.         }
  51.         else{
  52.             if(page_width < nice_width && doc_width > page_width + 10) {
  53.                 width = page_width;
  54.                 height = page_height;
  55.             }
  56.             else {
  57.                 width = (doc_width > perfect_width) ? perfect_width : doc_width - 10;
  58.                 height = page_height;
  59.                 height = (height*width)/page_width;
  60.             }
  61.             jQuery('#page .inner .preview img').attr({width:width, height:height});
  62.             jQuery('#page .inner img.open').attr({width:width, height:height});
  63.             jQuery("#page").css({'max-width':(width + 10) + 'px','overflow':'auto'});
  64.             jQuery("#page .inner img.open").css({'max-width':'100%'});
  65.             isSpread = false;
  66.             delete_message('is_spread');
  67.         }
  68.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement