1// åå§å 2$(function() { 3 // åå§åSDAPP 4 new SDAPP({ 5 "menu": { 6 type: "slide" 7 }, 8 "vmode": 0 9 }); 10}); 11 12/* 13*æå»ºSDAPP 14*/ 15SDAPP = (function(){ 16 function App(options){ 17 this.O = options; 18 this.J = jQuery; 19 this.init(); 20 } 21 return App; 22})(); 23 24SDAPP.prototype.init = function(){ 25 this.client(); 26 this.plugin(); 27 this.renew(); 28} 29 30/** 31 * getClient 32 */ 33SDAPP.prototype.client = function(){ 34 return { 35 "width":this.J(window).width(), 36 "height":this.J(window).height() 37 }; 38} 39 40/** 41 * resize 42 */ 43SDAPP.prototype.renew = function(){ 44 var _this = this; 45 _this.J(window).resize(function(event) { 46 _this.client(); 47 if (_this.O['vmode'] == 0) { 48 _this.switchMode(0); 49 } 50 }); 51} 52 53/** 54 * plugin 55 */ 56SDAPP.prototype.plugin = function(){ 57 var _this = this; 58 59 // menu 60 if(this.O['menu']){ 61 if(/slide/.test(this.O.menu['type'])){ 62 this.J(".wp-navi").addClass('wp-navi-slide'); 63 this.J(".navi-slide-head").on("click",function(){ 64 _this.J(this).siblings().slideToggle(150); 65 }); 66 } 67 } 68 69 // switchMode 70 // èªå¨åæ¢æ¨¡å¼ 71 if (_this.O['vmode'] == 0) { 72 _this.switchMode(0); 73 } 74 75 // small screen 76 if(this.client().width<768){ 77 // jumphandle 78 this.J('<div id="jumphandle"><a id="gotop"></a><a id="gobot"></a></div>').appendTo('body'); 79 this.J(window).scroll(function(event) { 80 /* Act on the event */ 81 var scrolltop = _this.J(window).scrollTop(); 82 if(scrolltop>200){ 83 _this.J("#jumphandle").show(); 84 }else{ 85 _this.J("#jumphandle").hide(); 86 } 87 }); 88 this.J("#gotop").on("click",function(){ 89 _this.J("body,html").stop().animate({scrollTop:0}, 500); 90 }); 91 this.J("#gobot").on("click",function(){ 92 _this.J("body,html").stop().animate({scrollTop:_this.J(document).height()}, 500); 93 }); 94 } 95 96} 97 98// mode = 0 auto 1 pc 2 mobile 99SDAPP.prototype.switchMode = function (mode) { 100 if (mode == 0) { 101 var width = jQuery(window).width(); 102 if (width < 768) { 103 this.switchMobileMode(); 104 } else { 105 this.switchPCMode(); 106 } 107 } else if (mode == 1) { 108 this.switchPCMode(); 109 } else if (mode == 2) { 110 this.switchMobileMode(); 111 } 112} 113SDAPP.prototype.switchMobileMode = function () { 114 var path = window.location.pathname; 115 var ohtmlFilename = path.substring(path.lastIndexOf('/') + 1); 116 var mhtmlFilename = ohtmlFilename; 117 if (mhtmlFilename=='') { 118 window.location.href = "mindex.html"; 119 } else if (mhtmlFilename && mhtmlFilename.charAt(0) != 'm') { 120 mhtmlFilename = 'm' + mhtmlFilename; 121 window.location.href = window.location.href.replace(ohtmlFilename, mhtmlFilename); 122 } 123} 124SDAPP.prototype.switchPCMode = function () { 125 var path = window.location.pathname; 126 var ohtmlFilename = path.substring(path.lastIndexOf('/') + 1); 127 var mhtmlFilename = ohtmlFilename; 128 if (mhtmlFilename && mhtmlFilename.charAt(0) == 'm') { 129 mhtmlFilename = mhtmlFilename.substring(1); 130 window.location.href = window.location.href.replace(ohtmlFilename, mhtmlFilename); 131 } 132}
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.