1$(document).ready(function(){ 2 mw.$('.mw-lazy-load-module').reload_module(); 3}); 4 5 6$(document).ready(function(){ 7 8 mw.common['data-mw-close'](); 9 mw.$(document.body) 10 .on('click', '[data-mw-dialog]', function(e){ 11 mw.common['data-mw-dialog'](e); 12 }) 13 .on('click', '[data-mw-close]', function(e){ 14 mw.common['data-mw-close'](e); 15 }); 16}); 17 18mw.common = { 19 setOptions:function (el, options) { 20 options = options || {}; 21 if(el.target){ 22 el = el.target; 23 } 24 var settings = el.getAttribute('data-mw-settings'); 25 try{ 26 settings = JSON.parse(settings); 27 } 28 catch(e){ 29 settings = {}; 30 } 31 return $.extend(options, settings) 32 33 }, 34 'data-mw-close':function(e){ 35 if(e && e.target){ 36 var data = e.target.getAttribute('data-mw-close'); 37 var cookie = JSON.parse(mw.cookie.get('data-mw-close') || '{}'); 38 mw.$(data).slideUp(function(){ 39 mw.$(this).remove(); 40 cookie[data] = true; 41 mw.cookie.set('data-mw-close', JSON.stringify(cookie)); 42 }) 43 } 44 else{ 45 var cookie = JSON.parse(mw.cookie.get('data-mw-close') || '{}'); 46 mw.$('[data-mw-close]').each(function(){ 47 var data = this.getAttribute('data-mw-dialog'); 48 if(cookie[data]){
49 mw.$(data).remove(); 50 } 51 }) 52 } 53 }, 54 'data-mw-dialog':function(e){ 55 var skin = 'basic'; 56 var overlay = true; 57 var data = e.target.getAttribute('data-mw-dialog'); 58 59 if(data){ 60 e.preventDefault(); 61 data = data.trim(); 62 var arr = data.split('.'); 63 var ext = arr[arr.length-1]; 64 if(data.indexOf('http') === 0){ 65 if(ext && /(gif|png|jpg|jpeg|bpm|tiff)$/i.test(ext)){ 66 mw.image.preload(data, function(w,h){ 67 var html = "<img src='"+data+"'>"; 68 var conf = mw.common.setOptions(e, { 69 width:w, 70 height:h, 71 content:html, 72 template:skin, 73 overlay:overlay, 74 overlayRemovesModal:true 75 }) 76 mw.dialog(conf); 77 }); 78 } 79 else{ 80 var conf = mw.common.setOptions(e, { 81 url:data, 82 width:'90%', 83 height:'auto%', 84 template:skin, 85 overlay:overlay, 86 overlayRemovesModal:true 87 }) 88 mw.dialogIframe(conf) 89 } 90 } 91 else if(data.indexOf('#') === 0 || data.indexOf('.') === 0){ 92 var conf = mw.common.setOptions(e, { 93 content:$(data)[0].outerHTML, 94 template:skin, 95 overlay:overlay, 96 overlayRemovesModal:true 97 }); 98 mw.dialog(conf); 99 } 100 } 101 } 102}
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.