1/******************************************************************************/ 2/******************************************************************************/ 3 4;(function($,doc,win) 5{ 6 "use strict"; 7 8 var windowDimensionListener=function(option) 9 { 10 /**********************************************************************/ 11 12 var option=option; 13 14 /**********************************************************************/ 15 16 this.create=function() 17 { 18 var i; 19 var timer; 20 var initial=false; 21 var dimension=[]; 22 23 var self=this; 24 25 var object= 26 [ 27 { 28 'object' : document.body, 29 'type' : 'body' 30 }, 31 { 32 'object' : window, 33 'type' : 'window' 34 } 35 ]; 36 37 for(i in object) 38 { 39 dimension[i]={}; 40 dimension[i].old=this.getDimension(object[i].object,object[i].type); 41 } 42 43 (function run() 44 { 45 for(i in object) 46 { 47 dimension[i].new=self.getDimension(object[i].object,object[i].type); 48 49 var c=[dimension[i].new.width!==dimension[i].old.width,dimension[i].new.height!==dimension[i].old.height]; 50 51 dimension[i].old=dimension[i].new; 52 53 if((c[0]===false) && (c[1]===false)) 54 { 55 if(!initial) 56 { 57 initial=true; 58 option.change(true,true); 59 break; 60 } 61 } 62 else 63 { 64 option.change(c[0],c[1]); 65 break; 66 } 67 } 68 69 timer=setTimeout(run,1000); 70 })(); 71 }; 72 73 /**************************************************************************/ 74 75 this.getDimension=function(object,type) 76 { 77 var dimension={}; 78 79 switch(type) 80 { 81 case 'body': 82 83 dimension.width=document.body.clientWidth; 84 dimension.height=document.body.clientHeight; 85 86 break; 87 88 default: 89 90 dimension.width=$(object).actual('width'); 91 dimension.height=$(object).actual('height'); 92 } 93 94 dimension.width=parseInt(dimension.width); 95 dimension.height=parseInt(dimension.height); 96 97 return(dimension); 98 }; 99 100 /**********************************************************************/ 101 }; 102 103 /**************************************************************************/ 104 105 $.fn.windowDimensionListener=function(option) 106 { 107 var element=new windowDimensionListener(option); 108 element.create(); 109 }; 110 111 /**************************************************************************/ 112 113})(jQuery,document,window);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.