PageSourceSearch

https://www.tsemrinpoche.com/wp-content/plugins/nextgen-gallery/shutter/shutter-reloaded.js

js tsemrinpoche.com collected 2026-10-02 05:09:21 UTC 22,514 bytes, 568 lines download raw bytes

1/*
2Shutter Reloaded for NextGEN Gallery
3http://www.laptoptips.ca/javascripts/shutter-reloaded/
4Version: 1.3.2
5Copyright (C) 2007-2008  Andrew Ozz (Modification by Alex Rabe)
6Released under the GPL, http://www.gnu.org/copyleft/gpl.html
7
8Acknowledgement: some ideas are from: Shutter by Andrew Sutherland - http://code.jalenack.com, WordPress - http://wordpress.org, Lightbox by Lokesh Dhakar - http://www.huddletogether.com, the icons are from Crystal Project Icons, Everaldo Coelho, http://www.everaldo.com
9
10*/
11
12/*
13shutterOnload = function(){shutterReloaded.init('sh');}
14
15if (typeof shutterOnload == 'function') {
16  if ('undefined' != typeof jQuery) jQuery(document).ready(function(){shutterOnload();});
17  else if( typeof window.onload != 'function' ) window.onload = shutterOnload;
18  else {oldonld = window.onload;window.onload = function(){if(oldonld){oldonld();};shutterOnload();}};
19}
20*/
21jQuery(document).ready(function(){shutterReloaded.init('sh');});
22
23shutterReloaded = {
24
25  I : function (a) {
26    return document.getElementById(a);
27  },
28
29  settings : function() {
30    var t = this, s = shutterSettings;
31
32    t.imageCount = s.imageCount || 0;
33    t.msgLoading = s.msgLoading || 'L O A D I N G';
34    t.msgClose = s.msgClose || 'Click to Close';
35    t.msgNext = s.msgNext || 'NEXT >';
36    t.msgPrev = s.msgPrev || '< PREV';
37    t.msgPrevNextHelp = s.msgPrevNextHelp || 'Press ← and → for previous and next photo';
38    t.msgCloseText = s.msgCloseText || 'Close';
39    t.msgClickDown = s.msgClickDown || 'Click to download high resolution image';
40  },
41
42  init : function (a) {
43    var t = this, L, T, ext, i, m, setid, inset, shfile, shMenuPre, k, img;
44    shutterLinks = {}, shutterSets = {};
45    shutterLinkMap = {};
46    shutterComments = {};
47
48    t.settings();
49
50    if ( 'object' != typeof shutterSettings ) shutterSettings = {};
51
52    var nggtemplate_download = false;
53    if ( jQuery( '.nggtemplate-download' ).length > 0 ) {
54      nggtemplate_download = true;
55    }
56
57    for ( i = 0; i < document.links.length; i++ ) {
58      L = document.links[i];
59      //ext = ( L.href.indexOf('?') == -1 ) ? L.href.slice(-4).toLowerCase() : L.href.substring( 0, L.href.indexOf('?') ).slice(-4).toLowerCase();
60      try {
61        ext = ( L.getAttribute('href').indexOf('?') == -1 ) ? L.getAttribute('href').slice(-4).toLowerCase() : L.getAttribute('href').substring( 0, L.getAttribute('href').indexOf('?') ).slice(-4).toLowerCase();
62      }
63      catch (err) {
64        continue;
65      }
66      if ( ext != '.jpg' && ext != '.png' && ext != '.gif' && ext != 'jpeg' ) continue;
67      if ( a == 'sh' && L.className.toLowerCase().indexOf('shutter') == -1 ) continue;
68      if ( a == 'lb' && L.rel.toLowerCase().indexOf('lightbox') == -1 ) continue;
69
70      if ( L.className.toLowerCase().indexOf('shutterset') != -1 )
71      setid = L.className.replace(/\s/g, '_');      
72      else if ( L.rel.toLowerCase().indexOf('lightbox[') != -1 )
73      setid = L.rel.replace(/\s/g, '_');
74      else setid = 0, inset = -1;
75
76      pid = L.id.replace(/ngg-link-/, '');
77      
78      if( setid ) {
79        if ( ! shutterSets[setid] ) shutterSets[setid] = [];
80          inset = shutterSets[setid].push(i);
81      }
82      
83      shfile = L.href.slice(L.href.lastIndexOf('/')+1);
84      T = ( L.title && L.title != shfile ) ? L.title : '';
85
86      owner = '';
87      if (L.className.toLowerCase().indexOf('user-pictures') >= 0) {
88        owner = 'mypicture-user';
89      }
90      else {
91        if (jQuery(L).parents('.mypicture-kfr').is('div')) {
92          owner = 'mypicture-kfr';
93        }
94        else if (jQuery(L).parents('.ngg-galleryoverview').is('div')) {
95          owner = 'nggoverview';
96        }
97        else if (jQuery(L).parents('.mypicture').is('div')) {
98          owner = 'mypicture';
99        }
100      }
101
102      // make clickable
103      if ( nggtemplate_download &&  typeof jQuery( '#' + L.id ).data( 'fullimg' ) !== 'undefined' ) {
104        fullimg = jQuery( '#' + L.id ).data( 'fullimg' );
105        if ( fullimg.length > 0 ) {
106          T = T + '<br/><a href="' + fullimg + '" target="_blank">'+t.msgClickDown+'</a>';
107        }
108      }
109      else {
110        if (T.indexOf('href="') < 0) {
111          T = T.replace(/((http|https):\/\/[^ ]+)/g, '<a href="$1" target="_blank">$1</a>');
112        }
113      }
114
115      //jQuery(L).click(function(e){e.preventDefault();});
116      
117      shutterLinks[i] = {link:L.href,num:inset,set:setid,title:T,pid:pid,owner:owner,lang:L.lang}
118      L.onclick = new Function('shutterReloaded.make("' + i + '");return false;');
119      shutterLinkMap[L.id] = i;
120    } // for
121
122    if (typeof nggpu !== 'undefined' && nggpu) {
123      for (i in shutterLinks) {
124        l = shutterLinks[i].link;
125        if (l.indexOf(nggpu, l.length - nggpu.length) !== -1) {
126          setTimeout('shutterReloaded.make('+i+')', 500);
127          //shutterReloaded.make(i);
128          break;
129        }
130      }
131
132    }
133
134  },
135
136  make : function(ln,fs) {
137    var t = this, prev, next, prevlink = '', nextlink = '', previmg, nextimg, D, S, W, fsarg = -1, imgNum, NavBar;
138
139    if ( ! t.Top ) {
140      if ( typeof window.pageYOffset != 'undefined' ) t.Top = window.pageYOffset;
141      else t.Top = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop;
142    }
143
144    if ( typeof t.pgHeight == 'undefined' )
145      t.pgHeight = Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
146
147    if ( fs ) t.FS = ( fs > 0 ) ? 1 : 0;
148    else t.FS = shutterSettings.FS || 0;
149
150    if ( t.resizing ) t.resizing = null;
151    // problem with IE
152    window.onresize = new Function('shutterReloaded.resize("'+ln+'");');
153    //jQuery(window).unbind('resize');
154    //jQuery(window).resize(function() { shutterReloaded.resize(ln
154); });
155
156    document.documentElement.style.overflowX = 'hidden';
157    if ( ! t.VP ) {
158      t._viewPort();
159      t.VP = true;
160    }
161
162    if ( ! (S = t.I('shShutter')) ) {
163      S = document.createElement('div');
164      S.setAttribute('id','shShutter');
165      document.getElementsByTagName('body')[0].appendChild(S);
166      t.hideTags();
167    }
168
169    if ( ! (D = t.I('shDisplay')) ) {
170      D = document.createElement('div');
171      D.setAttribute('id','shDisplay');
172      D.style.top = t.Top + 'px';
173      document.getElementsByTagName('body')[0].appendChild(D);
174    }
175
176    S.style.height = t.pgHeight + 'px';
177
178    var dv = t.textBtns ? ' | ' : '';
179    if ( shutterLinks[ln].num > 1 ) {
180      prev = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num - 2];
181      prevlink = '<a href="#" id="prevpic" onclick="shutterReloaded.make('+prev+');return false">'+t.msgPrev+'</a>'+dv;
182      previmg = new Image();
183      previmg.src = shutterLinks[prev].link;
184    } else {
185      prevlink = '';
186    }
187
188    if ( shutterLinks[ln].num != -1 && shutterLinks[ln].num < (shutterSets[shutterLinks[ln].set].length) ) {
189      next = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num];
190      nextlink = '<a href="#" id="nextpic" onclick="shutterReloaded.make('+next+');return false">'+t.msgNext+'</a>'+dv;
191      nextimg = new Image();
192      nextimg.src = shutterLinks[next].link;
193    } else {
194      nextlink = '';
195    }
196
197    pid = shutterLinks[ln].pid;
198
199    imgNum = ( (shutterLinks[ln].num > 0) && t.imageCount ) ? '<div id="shCount">&nbsp;(&nbsp;' + shutterLinks[ln].num + '&nbsp;/&nbsp;' + shutterSets[shutterLinks[ln].set].length + '&nbsp;)&nbsp;</div>' : '';
200
201    nggpu_v = nggpu_u;
202    nggpu_v = nggpu_v.replace("%nggpu%", 'nggpu=' + shutterLinks[ln].link.replace(/http:\/\//, ''));
203    nggpu_m = 'mailto:?body='+escape(nggpu_v)+'&subject='+escape('Share Photo');
204    InfoBar = '<div id="shInfo">'+'<div id="shInstruction" class="instruction">'+t.msgPrevNextHelp+'&nbsp;&nbsp;&nbsp;</div>'
205              +'<div class="close" onclick="shutterReloaded.hideShutter();">'+t.msgCloseText+'</div><div style="clear:both"></div></div>';
206
207    NavBar = '<div id="shTitle"><div id="shPrev">' + prevlink + '</div><div id="shNext">' + nextlink + '</div><div id="shName">' + shutterLinks[ln].title + '</div>' + imgNum + '</div>';
208
209    owner = shutterLinks[ln].owner;
210    if (!owner) {
211      if (jQuery('.ngg-galleryoverview').is('div')) { owner = 'nggoverview'; }
212      else if (jQuery('.mypicture').is('div')) { owner = 'mypicture'; }
213    }
214
215    if (typeof tr_multi_lang !== 'undefined' && tr_multi_lang) {
216      ShareBar = '<div id="shShare" style="display:none"></div>';
217    }
218    else {
219      if (owner == 'mypicture-user') {
220        ShareBar = '<div id="shShare" style="display:none"><a href="'+nggpu_m+'">Share this photo with anyone by sending them this public link:</a><br/>' + nggpu_v + '</div>';
221      }
222      else {
223        ShareBar = '<div id="shShare"><a href="'+nggpu_m+'">Share this photo with anyone by sending them this public link:</a><br/>' + nggpu_v + '</div>';
224      }
225    }
226    CommentBar = '<div id="shComment"></div>';
227    ImageGridBar = '<div id="shImageGrid"></div>';
228
229    D.innerHTML = '<div id="shWrap">' + InfoBar + '<img src="'+shutterLinks[ln].link+'" id="shTopImg" title="' + t.msgClose + '" onload="shutterReloaded.showImg();" onclick="shutterReloaded.hideShutter();" data-pid="'+shutterLinks[ln].pid+'"/>'+NavBar+ShareBar+'<div id="shCommentGridCont">'+CommentBar+ImageGridBar+'</div></div>';
230    
231    T = t.I('shTitle');
232    T.style.width = Math.round(t.wWidth * 0.7) + 'px';
233
234    SH = t.I('shShare');
235    SH.style.width = Math.round(t.wWidth * 0.7) + 'px';
236
237    //jQuery('#shDisplay').css('background-image', 'url(../images/loader.gif)');
238    //jQuery('#shDisplay').css('backgroundImage', D_bg_img);
239    pos = Math.round(t.wWidth/2) + 'px ' + Math.round(t.wHeight/2) + 'px';
240    jQuery('#shDisplay').css({backgroundPosition: pos});
241
242    show_view_more_photo = true;
243    if (typeof tr_multi_lang !== 'undefined' && tr_multi_lang) show_view_more_photo = false;
244
245    if (owner) {
246      if (owner == 'nggoverview') {
247        jQuery('#shImageGrid').html('');
248        //jQuery('#shImageGrid').html(jQuery('.ngg-galleryoverview').html());
249        jQuery('.ngg-galleryoverview').first().clone().appendTo(jQuery('#shImageGrid'));
250        //jQuery('#shImageGrid').find('.ngg-navigation').remove();
251        jQuery('#shImageGrid').find('a').each(function(index) {
252          id = jQuery(this).attr('id');
253          if (shutterLinkMap[id]) {
254            i = shutterLinkMap[id];
255            jQuery(this).click(new Function('shutterReloaded.make("' + i + '");return false;'));
256          }
257        });
258        //
259        jQuery('#shImageGrid .ngg-gallery-thumbnail-box').css('width', '20%');
260        jQuery('#shImageGrid .ngg-galleryoverview > br').remove();
261        jQuery('#shImageGrid .ngg-gallery-thumbnail > span').hide();
262        jQuery('#shImageGrid #ngg-link-'+pid+ ' img').addClass('selected');
263      }
264      else if (owner == 'mypicture') {
265        html = '<div class="ngg-galleryoverview">';
266        col_i = 0;
267        jQuery('.mypicture').children('.mypicture-holder').each(function(index) {
268          html += '<div class="ngg-gallery-thumbnail-box" style="width:20%;">';
269          html += '<div class="ngg-gallery-thumbnail">';
270          src_a = jQuery(this).find('a.shutterset_photos-on-the-go');
271          src_img = jQuery(this).find('img');
272          d = jQuery(this).find('.mypicture-desc').clone();
273          d.find('a').remove();
274          desc = t.get_first_words(d.html());
275          current_id = src_a.attr('id').replace(/ngg-link-/, '');
276          selected = "";
277          if ( current_id == pid ) {
278            selected = "selected";
279          }          
280          img = '<img src="'+src_img.attr('src')+'" width="160" height="auto" style="height:auto !important;"'+' class="'+selected+'"/>';
281          html += '<a id="' + src_a.attr('id') + '" href="'+src_a.attr('href')+'">'+img+'</a>';
282          html += '<span style="display:none;">' + desc + '</span>';
283          html += '</div>';
284          html += '</div>';
285          if (++col_i == 5) {
286            html += '<br style="clear: both">';
287            col_i = 0;
288          }
289        });
290        if (show_view_more_photo) {
291          url = jQuery('a#mypicture-viewall-a').attr('href');
292          url += (url.indexOf('?') == -1 ? '?' : '&') + 'nggpage=2';
293          html += '<div class="clear"></div>';
294          html += '<div><a href="'+url+'">View more photos</a></div>';
295          html += '</div>';
296        }
297        jQuery('#shImageGrid').html(html);
298        jQuery('#shImageGrid').find('a').each(function(index) {
299          id = jQuery(this).attr('id');
300          if (shutterLinkMap[id]) {
301            i = shutterLinkMap[id];
302            jQuery(this).click(new Function('shutterReloaded.make("' + i + '");return false;'));
303          }
304        });
305      }
306      else if (owner == 'mypicture-user') {
307        html = '<div class="ngg-galleryoverview">';
308        col_i = 0;
309        jQuery('.mypicture-user').children('.mypicture-user-holder').each(function(index) {
310          html += '<div class="ngg-gallery-thumbnail-box" style="width:20%;">';
311          html += '<div class="ngg-gallery-thumbnail">';
312          src_a = jQuery(this).find('a.shutterset_user-pictures');
313          src_img = jQuery(this).find('img');
314          d = jQuery(this).find('.mypicture-user-desc').clone();
315          d.find('a').remove();
316          desc = t.get_first_words(d.html());
317          current_id = src_a.attr('id').replace(/ngg-link-/, '');
318          selected = "";
319          if ( current_id == pid ) {
320            selected = "selected";
321          }
322          img = '<img src="'+src_img.attr('src')+'" width="160" height="auto" style="height:auto !important;"'+' class="'+selected+'"/>';
323          html += '<a id="' + src_a.attr('id') + '" href="'+src_a.attr('href')+'">'+img+'</a>';
324          html += '<span style="display:none;">' + desc + '</span>';
325          html += '</div>';
326          html += '</div>';
327          if (++col_i == 5) {
328            html += '<br style="clear: both">';
329            col_i = 0;
330          }
331        });
332        if (show_view_more_photo) {
333          url = jQuery('a#mypicture-user-viewall-a').attr('href');
334          url += (url.indexOf('?') == -1 ? '?' : '&') + 'nggpage=2';
335          html += '<div class="clear"></div>';
336          html += '<div><a href="'+url+'">View more photos</a></div>';
337          html += '</div>';
338        }
339        jQuery('#shImageGrid').html(html);
340        jQuery('#shImageGrid').find('a').each(function(index) {
341          id = jQuery(this).attr('id');
342          if (shutterLinkMap[id]) {
343            i = shutterLinkMap[id];
344            jQuery(this).click(new Function('shutterReloaded.make("' + i + '");return false;'));
345          }
346        });
347      }
348      else if (owner == 'mypicture-kfr') {
349        html = '<div class="ngg-galleryoverview">';
350        col_i = 0;
351        jQuery('.mypicture-kfr').find('.ngg-gallery-thumbnail-box').each(function(index) {
352          html += '<div class="ngg-gallery-thumbnail-box" style="width:20%;">';
353          html += '<div class="ngg-gallery-thumbnail">';
354          src_a = jQuery(this).find('a.shutterset_set_50');
355          src_img = jQuery(this).find('img');
356          d = jQuery(this).find('.ngg-gallery-thumbnail span').clone();
357          d.find('a').remove();
358          desc = t.get_first_words(d.html());
359          current_id = src_a.attr('id').replace(/ngg-link-/, '');
360          selected = "";
361          if ( current_id == pid ) {
362            selected = "selected";
363          }          
364          img = '<img src="'+src_img.attr('src')+'" width="160" height="auto" style="height:auto !important;"'+' class="'+selected+'"/>';
365          html += '<a id="' + src_a.attr('id') + '" href="'+src_a.attr('href')+'">'+img+'</a>';
366          html += '<span style="display:none;">' + desc + '</span>';
367          html += '</div>';
368          html += '</div>';
369          if (++col_i == 5) {
370            html += '<br style="clear: both">';
371            col_i = 0;
372          }
373        });
374        jQuery('#shImageGrid').html(html);
375        jQuery('#shImageGrid').find('a').each(function(index) {
376          id = jQuery(this).attr('id');
377          if (shutterLinkMap[id]) {
378            i = shutterLinkMap[id];
379            jQuery(this).click(new Function('shutterReloaded.make("' + i + '");return false;'));
380          }
381        });
382      }
383    }
384
385    document.onkeydown = function(event){shutterReloaded.handleArrowKeys(event);};
386    //Google Chrome 4.0.249.78 bug for onload attribute
387    document.getElementById('shTopImg').src = shutterLinks[ln].link;
388
389    show_comment = true;
390    if (typeof tr_multi_lang !== 'undefined' && tr_multi_lang) show_comment = false;
391    if (show_comment && pid) {
392      if (shutterComments[pid]) {
393        jQuery('#shComment').html(shutterComments[pid]);
394      }
395      else {
396        jQuery('#shComment').html('Loading ... <span class="picture-loading"></span>');
397        data = { action: 'nggallery_get_comments', pid: pid, lang: shutterLinks[ln].lang };
398        jQuery.post('/wp-admin/admin-ajax.php', data, function(response) {
399          shutterComments[pid] = response;
400          t.clearCommentCache(pid);
401          jQuery('#shComment').html(response);
402        });
403      }
404    }
405    
406    window.setTimeout(function(){shutterReloaded.loading();},2000);
407  },
408
409  clearCommentCache : function(id) {
410    window.setTimeout(function() { shutterComments[id] = ''; }, 30000);
411  },
412
413  loading : function() {
414    var t = this, S, WB, W;
415    if ( (W = t.I('shWrap')) && W.style.visibility == 'visible' ) return;
416    if ( ! (S = t.I('shShutter')) ) return;
417    if ( t.I('shWaitBar') ) return;
418    WB = document.createElement('div');
419    WB.setAttribute('id','shWaitBar');
420    WB.style.top = t.Top + 'px';
421    WB.innerHTML = t.msgLoading;
422    S.appendChild(WB);
423  },
424
425  hideShutter : function() {
426    var t = this, D, S;
427    if ( D = t.I('shDisplay') ) D.parentNode.removeChild(D);
428    if ( S = t.I('shShutter') ) S.parentNode.removeChild(S);
429    t.hideTags(true);
430    window.scrollTo(0,t.Top);
431    window.onresize = t.FS = t.Top = t.VP = null;
432    //jQuery(window).unbind('resize');
433    document.documentElement.style.overflowX = '';
434    document.onkeydown = null;
435  },
436
437  resize : function(ln) {
438    var t = this;
439
440    if ( t.resizing ) return;
441    if ( ! t.I('shShutter') ) return;
442    var W = t.I('shWrap');
443    if ( W ) W.style.visibility = 'hidden';
444
445    window.setTimeout(function(){shutterReloaded.resizing = null},500);
446    window.setTimeout(new Function('shutterReloaded.VP = null;shutterReloaded.make("'+ln+'");'),100);
447    t.resizing = true;
448  },
449
450  _viewPort : function() {
451    var t = this;
452    var wiH = window.innerHeight ? window.innerHeight : 0;
453    var dbH = document.body.clientHeight ? document.body.clientHeight : 0;
454    var deH = document.documentElement ? document.documentElement.clientHeight : 0;
455
456    if( wiH > 0 ) {
457      t.wHeight = ( (wiH - dbH) > 1 && (wiH - dbH) < 30 ) ? dbH : wiH;
458      t.wHeight = ( (t.wHeight - deH) > 1 && (t.wHeight - deH) < 30 ) ? deH : t.wHeight;
459    } else t.wHeight = ( deH > 0 ) ? deH : dbH;
460
461    var deW = document.documentElement ? document.documentElement.clientWidth : 0;
462    var dbW = window.innerWidth ? window.innerWidth : document.body.clientWidth;
463    t.wWidth = ( deW > 1 ) ? deW : dbW;
464  },
465
466  showImg : function() {
467    var t = this, S = t.I('shShutter'), D = t.I('shDisplay'), TI = t.I('shTopImg'), T = t.I('shTitle'), NB = t.I('shNavBar'), W, WB, wHeight, wWidth, shHeight, maxHeight, itop, mtop, resized = 0;
468    var INFO = t.I('shInfo');
469
470    if ( ! S ) return;
471    if ( (W = t.I('shWrap')) && W.style.visibility == 'visible' ) return;
472    if ( WB = t.I('shWaitBar') ) WB.parentNode.removeChild(WB);
473
474    S.style.width = D.style.width = '';
475    //T.style.width = (TI.width - 4) + 'px';
476    T.style.width = Math.round(t.wWidth * 0.7) + 'px';
477    jQuery('#shDisplay').css({backgroundPosition: '-100px -100px'});
478
479    //shHeight = t.wHeight - 50;
480    shHeight = t.wHeight - 90 - T.clientHeight - 135;
481    // DEBUG
482    //shHeight = 50
483
484    if ( t.FS ) {
485      if ( TI.width > (t.wWidth - 10) )
486      S.style.width = D.style.width = TI.width + 10 + 'px';
487      document.documentElement.style.overflowX = '';
488    } else {
489      window.scrollTo(0,t.Top);
490      if ( TI.height > shHeight ) {
491        TI.width = TI.width * (shHeight / TI.height);
492        TI.height = shHeight;
493        resized = 1;
494      }
495      /*
496      if ( TI.width > (t.wWidth - 16) ) {
497        TI.height = TI.height * ((t.wWidth - 16) / TI.width);
498        TI.width = t.wWidth - 16;
499        resized = 1;
500      }
501      */
502      if ( TI.width > (t.wWidth * 0.7) ) {
503        TI.height = TI.height * ((t.wWidth * 0.7) / TI.width);
504        TI.width = t.wWidth * 0.7;
505        resized = 1;
506      }
507      //T.style.width = (TI.width - 4) + 'px';
508      T.style.width = Math.round(t.wWidth * 0.7) + 'px';
509      INFO.style.width = T.style.width;
510    }
511
512    maxHeight = t.Top + TI.height + 10;
513    if ( maxHeight > t.pgHeight ) S.style.height = maxHeight + 'px';
514    window.scrollTo(0,t.Top);
515
516    //itop = (shHeight - TI.height) * 0.45;
517    itop = 0;
518    mtop = (itop > 3) ? Math.floor(itop) : 3;
519    D.style.top = t.Top + mtop + 'px';
520    D.style.width = t.wWidth + 'px';
521    S.style.width = t.wWidth + 'px';
522    W.style.visibility = 'visible';
523  },
524
525  hideTags : function(arg) {
526    var sel = document.getElementsByTagName('select');
527    var obj = document.getElementsByTagName('object');
528    var emb = document.getElementsByTagName('embed');
529    var ifr = document.getElementsByTagName('iframe');
530
531    var vis = ( arg ) ? 'visible' : 'hidden';
532
533    for (i = 0; i < sel.length; i++) sel[i].style.visibility = vis;
534    for (i = 0; i < obj.length; i++) obj[i].style.visibility = vis;
535    for (i = 0; i < emb.length; i++) emb[i].style.visibility = vis;
536    for (i = 0; i < ifr.length; i++) ifr[i].style.visibility = vis;
537  },
538  
539  handleArrowKeys : function(e) {
540      var code = 0;
541      if (!e) var e = window.event
542        if (e.keyCode) code = e.keyCode;
543        else if (e.which) code = e.which;
544        
545    var nextlink = document.getElementById('prevpic');
546    var prevlink = document.getElementById('nextpic');
547    var closelink = document.getElementById('shTopImg');
548  
549    switch (code) {
550        case 39:
551      if (prevlink) prevlink.onclick();
552      break;    
553        case 37:
554      if (nextlink) nextlink.onclick();
555      break;    
556        case 27:
557      if (closelink) closelink.onclick();
558      break;    
559     }
560  },
561
562  get_first_words : function(s) {
563    s2 = s.replace(/(([^\s]+\s\s*){20})(.*)/,"$1");
564    if (s == s2) return s;
565    return s2 += '...';
566  }
567
568}

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.