PageSourceSearch

http://www.zagarmusic.com/wp-content/plugins/alpine-photo-tile-for…/js/AlpinePhotoTiles_script.js?ver=1.2.6

js zagarmusic.com collected 2026-10-02 12:45:23 UTC 20,777 bytes, 598 lines download raw bytes

1/*
2 * Alpine PhotoTile : jQuery Tile Display Functions
3 * By: Eric Burger, http://thealpinepress.com
4 * Version: 1.0.3
5 * Updated: April  2013
6 * 
7 */
8
9(function( w, s, d ) {
10  s.fn.AlpinePhotoTilesPlugin = function( options ) {
11  
12    options = s.extend( {}, s.fn.AlpinePhotoTilesPlugin.options, options );
13  
14    // IE 7 fallback
15    /*if(!d.querySelector){
16      if('windows' != options.style){
17        options.style = 'rift';
18      }
19    }*/
20    return this.each(function() {  
21      var parent = s(this), 
22        imageList = s(".AlpinePhotoTiles_image_list_class",parent),
23        images = s('.AlpinePhotoTiles-image',imageList),
24        allPerms = s('.AlpinePhotoTiles-link',imageList),
25        width = parent.width(),
26        currentRow,img,newDiv,newDivContainer,src,url,height,theClasses,theHeight,theWidth,perm,nextHeight,tempW,tempH,
27        imageRow=[],row,currentImage,sumWidth=0,maxHeight=0,pos,normalWidth,normalHeight;
28     
29      if( 'square' == options.shape && 'windows' == options.style ){
30        s.each(images, function(i){
31          img = this;
32          src = img.src;
33          url = 'url("'+src+'")';
34          perm = allPerms[i];
35          
36          if(i%3 == 0){
37            
38            theClasses = "AlpinePhotoTiles-tile";
39            theWidth = (width-8);
40            theHeight = theWidth;
41            newRow( theHeight, i );
42            addDiv(i);
43            
44          }else if(i%3 == 1){
45
46            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-first";
47            theWidth = (width/2-4-4/2);
48            theHeight = theWidth;
49            newRow( theHeight, i );
50            addDiv(i);
51     
52          }else if(i%3 == 2){
53        
54            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-last";
55            theWidth = (width/2-4-4/2);
56            theHeight = theWidth;
57            addDiv(i);
58          }
59          
60          
61        });
62      }
63      else if( 'rectangle' == options.shape && 'windows' == options.style ){
64        s.each(images, function(i){
65          img = this;
66          src = img.src;
67          url = 'url("'+src+'")';
68          perm = allPerms[i];
69          
70          if(i%3 == 0){
71            theWidth = (width-8);
72            height = theWidth*img.naturalHeight/img.naturalWidth;
73            height = (height?height:width);
74            
75            newRow( height, i );
76                        
77            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-tile-rectangle";
78            theHeight = (height);
79
80            addDiv(i);
81            
82          }else if(i%3 == 1){
83            theWidth = (width/2-4-4/2);
84            height = theWidth*img.naturalHeight/img.naturalWidth;
85            height = (height?height:width);
86            newRow( height, i );
87            
88            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-first AlpinePhotoTiles-tile-rectangle";
89            theHeight = (height);
90            theWidth = (width/2-4-4/2);
91            addDiv(i);
92            
93          }else if(i%3 == 2){
94            theWidth = (width/2-4-4/2);
95            nextHeight = theWidth*img.naturalHeight/img.naturalWidth;
96            nextHeight = (nextHeight?nextHeight:theWidth);
97            if(nextHeight && nextHeight<height){
98              height = nextHeight;
99              updateHeight(newDivContainer,height);
100              currentRow.css({'height':height+'px'});
101            }
102                        
103            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-last AlpinePhotoTiles-tile-rectangle";
104            theHeight = (height);
105            addDiv(i);
106          }
107
108        });
109      }      
110      else if( 'floor' == options.style ){
111        parent.css({'width':'100%'});
112        width = parent.width();
113        theWidth = (width/options.perRow-4-4/options.perRow);
114        theHeight = (width/options.perRow);
115          
116        s.each(images, function(i){
117          img = this;
118          src = img.src;
119          url = 'url("'+src+'")';
120          perm = allPerms[i];
121          
122          if(i%options.perRow == 0){
123            newRow( width/options.perRow, i ); 
124            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-first";            
125            addDiv(i);
126          }else if(i%options.perRow == (options.perRow -1) ){
127            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-last";
128            addDiv(i);
129          }else{    
130            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile";
131            addDiv(i);
132          }
133        });
134      }
135      else if( 'wall' == options.style ){
136        parent.css({'width':'100%'});
137        width = parent.width();
138        imageRow=[];sumWidth=0;maxHeight=0;
139        theHeight = (width/options.perRow);
140        
141        s.each(images, function(i){
142          img = this;
143          src = img.src;
144          url = 'url("'+src+'")';
145          perm = allPerms[i];
146
147          tempW = (img.naturalWidth?img.naturalWidth:width);
148          tempH = (img.naturalHeight?img.naturalHeight:width);
149          
150          currentImage = {
151            "width":tempW,
152            "height":tempH,
153            "url":url,
154            "perm":perm,
155            "src":src,
156            "img":img
157          } 
158          sumWidth += tempW;
159          imageRow[imageRow.length] = currentImage;  
160          
161          if(i%options.perRow == (options.perRow -1) || (images.length-1)==i ){
162            if( (images.length-1)==i ){
163              sumWidth += (options.perRow - i%options.perRow -1)*imageRow[imageRow.length-1].width;
164            }
165            
166            newRow(theHeight , i );
167
168            pos = 0;
169            s.each(imageRow,function(j){
170              normalWidth = this.width/sumWidth*width;
171              
172              img = this.img;  
173              url = this.url;
174              perm = this.perm;
175              src = this.src;
176              theClasses = "AlpinePhotoTiles-tile";
177              theWidth = (normalWidth-4-4/options.perRow);
178              addDiv(j);
179              
180              newDivContainer.css({
181                'left':pos+'px'
182              });
183              
184              pos += normalWidth;
185            });
186          
187            imageRow=[];sumWidth=0;
188          } 
189        });
190      }
191      else if( 'bookshelf' == options.style ){
192        parent.css({'width':'100%'});
193        width = parent.width();
194        imageRow=[];sumWidth=0;maxHeight=0;
195
196        s.each(images, function(i){
197          img = this;
198          src = img.src;
199          url = 'url("'+src+'")';
200          perm = allPerms[i];
201
202          tempW = (img.naturalWidth?img.naturalWidth:width);
203          tempH = (img.naturalHeight?img.naturalHeight:width);
204          
205          currentImage = {
206            "width":tempW,
207            "height":tempH,
208            "url":url,
209            "perm":perm,
210            "src":src,
211            "img":img
212          } 
213          sumWidth += tempW;
214          imageRow[imageRow.length] = currentImage;  
215          
216          if(i%options.perRow == (options.perRow -1) || (images.length-1)==i ){
217            if( (images.length-1)==i ){
218              sumWidth += (options.perRow - i%options.perRow -1)*imageRow[imageRow.length-1].width;
219            }
220            
221            newRow( 10, i );
222            currentRow.addClass('AlpinePhotoTiles-bookshelf');
223            pos = 0;
224            s.each(imageRow,function(){
225              normalWidth = this.width/sumWidth*width;
226              normalHeight = normalWidth*this.height/this.width;
227            
228              if( normalHeight > maxHeight ){
229                maxHeight = normalHeight;
230                currentRow.css({'height':normalHeight+"px"});
231              }
232              img = this.img;  
233              url = this.url;
234              perm = this.perm;
235              src = this.src;
236              theClasses = "AlpinePhotoTiles-book";
237              theWidth = (normalWidth-4-4/options.perRow);
238              theHeight = normalHeight;
239              addDiv(i);
240              
241              newDivContainer.css({
242                'left':pos+'px'
243              });
244              
245              pos += normalWidth;
246            });
247          
248            imageRow=[];sumWidth=0;maxHeight=0;
249          }          
250          
251        });
252      }      
253      else if( 'rift' == options.style ){
254        parent.css({'width':'100%'});
255        width = parent.width();
256        imageRow=[];sumWidth=0;maxHeight=0;row=0;
257        
258        s.each(images, function(i){
259          img = this;
260          src = img.src;
261          url = 'url("'+src+'")';
262          perm = allPerms[i];
263          
264          tempW = (img.naturalWidth?img.naturalWidth:width);
265          tempH = (img.naturalHeight?img.naturalHeight:width);
266          
267          currentImage = {
268            "width":tempW,
269            "height":tempH,
270            "url":url,
271            "perm":perm,
272            "src":src,
273            "img":img
274          } 
275          sumWidth += tempW;
276          imageRow[imageRow.length] = currentImage;  
277          
278          if(i%options.perRow == (options.perRow -1) || (images.length-1)==i ){
279            if( (images.length-1)==i ){
280              sumWidth += (options.perRow - i%options.perRow -1)*imageRow[imageRow.length-1].width;
281            }
282            newRow( 10, i );
283            currentRow.addClass('AlpinePhotoTiles-riftline');
284            pos = 0;
285            s.each(imageRow,function(){
286              normalWidth = this.width/sumWidth*width;
287              normalHeight = normalWidth*this.height/this.width;
288              if( normalHeight > maxHeight ){
289                maxHeight = normalHeight;
290                currentRow.css({'height':normalHeight+"px"});
291              }
292              img = this.img;              
293              url = this.url;
294              perm = this.perm;
295              src = this.src;
296              theClasses = 'AlpinePhotoTiles-rift AlpinePhotoTiles-float-'+row;
297              theWidth = (normalWidth-4-4/options.perRow);
298              theHeight = normalHeight;
299              addDiv(i);
300              
301              newDivContainer.css({
302                'left':pos+'px'
303              });
304              
305              pos += normalWidth;
306            });
307          
308            imageRow=[];sumWidth=0;maxHeight=0,row=(row?0:1);
309          }          
310          
311        });
312      }   
313      else if( 'gallery' == options.style ){
314        parent.css({'width':'100%','opacity':0});
315        width = parent.width();
316        var originalImages = s('img.AlpinePhotoTiles-original-image',parent);
317        
318        var gallery,galleryContainer,galleryHeight;
319        theWidth = (width/options.perRow-4-4/options.perRow);
320        theHeight = (width/options.perRow);
321             
322        s.each(images, function(i){
323          img = this;
324          src = img.src;
325          url = 'url("'+src+'")';
326          perm = allPerms[i];
327          
328          if( 0 == i ){
329            if( options.galleryHeight ){ // Keep for compatibility
330              galleryHeight = width/options.perRow*options.galleryHeight;
331            }else if( options.galRatioHeight && options.galRatioWidth ){
332              galleryHeight = width*options.galRatioHeight/options.galRatioWidth;
333            }else{
334              galleryHeight = width*600/800;
335            }
336            
337            newRow( galleryHeight, i ); 
338                 
339            galleryContainer = s('<div class="AlpinePhotoTiles-image-div-container AlpinePhotoTiles-gallery-container"></div>');
340            galleryContainer.css({
341              "height":galleryHeight+"px",
342              "width":(width-8)+"px"
343            });
344            
345            currentRow.append(galleryContainer);
346                             
347            if(options.imageBorder){
348              galleryContainer.addClass('AlpinePhotoTiles-border-div');
349              galleryContainer.width( galleryContainer.width()-10 );
350              galleryContainer.height( galleryContainer.height()-10 );
351            }
352            if(options.imageShadow){
353              galleryContainer.addClass('AlpinePhotoTiles-shadow-div');
354            }
355            if(options.imageCurve){
356              galleryContainer.addClass('AlpinePhotoTiles-curve-div');
357            }
358
359          }
360                    
361          if(i%options.perRow == 0){     
362            newRow( width/options.perRow, i ); 
363            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-first";            
364            addDiv(i);
365          }else if(i%options.perRow == (options.perRow -1) ){           
366            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile AlpinePhotoTiles-half-tile-last";            
367            addDiv(i);
368          }else{
369            theClasses = "AlpinePhotoTiles-tile AlpinePhotoTiles-half-tile";            
370            addDiv(i);
371          }
372          
373          var storeUrl = url;
374          if( originalImages[i] ){
375            if( originalImages[i].src ){
376              storeUrl = 'url("'+originalImages[i].src+'")';
377            }
378          }
379
380          gallery = s('<div id="'+parent.attr('id')+'-image-'+i+'-gallery" class="AlpinePhotoTiles-image-div AlpinePhotoTiles-image-gallery"></div>');   
381          gallery.css({
382            'background-image':storeUrl
383          });
384          if( 0 != i ){
385            gallery.hide();
386          }
387          galleryContainer.append(gallery);
388          
389          // Prevent Right-Click
390          if( img.oncontextmenu ){
391            gallery.attr("oncontextmenu","return false;");
392          }
393          
394        });  
395
396        var allThumbs = s('.AlpinePhotoTiles-image-div',parent);
397        var allGalleries = s('.AlpinePhotoTiles-image-gallery',parent);
398        s.each(allThumbs,function(){
399          var theThumb = s(this);
400          if( !theThumb.hasClass('AlpinePhotoTiles-image-gallery') ){
401            theThumb.hover(function() {
402              allGalleries.hide();
403              s("#"+theThumb.attr('id')+"-gallery").show();
404            }); 
405          }
406        });
407        
408        parent.ready(function(){
409          parent.css({'opacity':1});
410        });
411      }
412    
413      // Lastly, call lighbox if applicable
414      if(options.callback){
415        options.callback();
416      }
417      
418      function newRow(height,i){
419        if(s.browser.msie && !d.querySelector){
420          currentRow = s('<div></div>');
421          currentRow.css({'height':height+'px'});
422          parent.append(currentRow);
423          
424        }else{
425          currentRow = s('<div class="AlpinePhotoTiles-row"></div>');
426          currentRow.css({'height':height+'px'});
427          parent.append(currentRow);
428        }  
429      }
430      function addDiv(i){
431        if(s.browser.msie && !d.querySelector){
432          newDiv = s('<div id="'+parent.attr('id')+'-image-'+i+'" class="AlpinePhotoTiles-image-div" style='+"'"+'background:'+url+' no-repeat center center;'+"'"+'></div>');                
433        }else{
434          newDiv = s('<div id="'+parent.attr('id')+'-image-'+i+'" class="AlpinePhotoTiles-image-div"></div>');   
435          newDiv.css({
436            'background-image':url
437          });  
438        }
439        // Prevent Right-Click
440        if( img.oncontextmenu ){
441          newDiv.attr("oncontextmenu","return false;");
442        }
443        
444        newDivContainer = s('<div class="AlpinePhotoTiles-image-div-container '+theClasses+'"></div>');
445        
446        if(s.browser.msie && !d.querySelector){
447          newDivContainer.css({
448            "height":(theHeight*0.99)+"px",
449            "width":(theWidth)+"px",
450            "overflow":"hidden"
451          });
452        }else{
453          newDivContainer.css({
454            "height":theHeight+"px",
455            "width":theWidth+"px"
456          });
457        }
458        
459        currentRow.append(newDivContainer);
460        newDivContainer.append(newDiv);
461        
462        if(perm){
463          if(options.lightbox){
464            newDiv.wrap('<a href="'+perm.href+'" title="'+perm.title+'" alt="'+perm.title+'"  class="AlpinePhotoTiles-link AlpinePhotoTiles-lightbox" target="_blank"></a>');
465            s(perm).removeClass( 'AlpinePhotoTiles-lightbox' );
466          }else{
467            newDiv.wrap('<a href="'+perm.href+'" class="AlpinePhotoTiles-link" target="_blank"></a>');
468          }
469        }
470        /*if( img.title ){
471          newDivContainer.append('<div style="position:absolute;bottom:10px;right:10px;background:#fff;padding:3px;border-radius: 2px 2px 2px 2px;opacity:0.85;">'+img.title+'</div>');
472        }*/
473        if(options.imageBorder){
474          newDivContainer.addClass('AlpinePhotoTiles-border-div');
475          newDivContainer.width( newDivContainer.width()-10 );
476          newDivContainer.height( newDivContainer.height()-10 );
477        }
478        if(options.imageHighlight){
479          if(!options.imageBorder){
480            newDivContainer.addClass('AlpinePhotoTiles-highlight-div');
481            newDivContainer.width( newDivContainer.width()-4 );
482            newDivContainer.height( newDivContainer.height()-4 );
483          }
484          newDivContainer.hover(function(){
485            s(this).css({
486              "background": options.highlight
487            });
488          },function(){
489            s(this).css({
490              "background-color": "#fff"
491            });
492          });
493        }
494        if(options.imageShadow){
495          newDivContainer.addClass('AlpinePhotoTiles-shadow-div');
496        }
497        if(options.imageCurve){
498          newDivContainer.addClass('AlpinePhotoTiles-curve-div');
499        }
500        if(options.pinIt){
501          var media = s(img).attr('data-original');
502          media = (media?media:src);
503          newDiv.addClass('AlpinePhotoTiles-pinterest-container');
504          var link = s('<div class="AlpinePhotoTiles-pin-it small" ><a href="http://pinterest.com/pin/create/button/?media='+media+'&url='+(options.siteURL)+'" class="pin-it-button" count-layout="horizontal" target="_blank" style="height:100%;width:100%;display:block;"></a></div>');
505          newDiv.append(link);
506        }
507      }
508      
509      function updateHeight(aDiv,aHeight){
510        aDiv.height(aHeight);
511        if(options.imageBorder){
512          aDiv.height( aDiv.height()-10 );
513        }
514      }
515
516    });
517  }
518  
519  s.fn.AlpinePhotoTilesPlugin.options = {
520    id: 'AlpinePress',
521    pinIt: false,
522    lightbox:false
523  }
524})( window, jQuery, document );
525  
526  
527(function( w, s ) {
528  s.fn.AlpineAdjustBordersPlugin = function( options ) {
529    return this.each(function() {  
530      var parent = s(this),images = s('img',parent);
531
532      s.each(images,function(){
533        var currentImg = s(this);
534        var width = currentImg.parent().width();
535        
536        // Remove and replace ! important classes
537        if( currentImg.hasClass('AlpinePhotoTiles-img-border') ){
538          width -= 10;
539          currentImg.removeClass('AlpinePhotoTiles-img-border');
540          currentImg.css({
541            'max-width':(width)+'px',
542            'padding':'4px',
543            "margin-left": "1px",
544            "margin-right": "1px"
545          });
546        }else if( currentImg.hasClass('AlpinePhotoTiles-img-noborder') ){
547          currentImg.removeClass('AlpinePhotoTiles-img-noborder');
548          currentImg.css({
549            'max-width':(width)+'px',
550            'padding':'0px'
551          });
552        }
553        
554        if( currentImg.hasClass('AlpinePhotoTiles-img-shadow') ){
555          width -= 2;
556          currentImg.removeClass('AlpinePhotoTiles-img-shadow');
557          currentImg.css({
558            "box-shadow": "0 1px 3px rgba(34, 25, 25, 0.4)",
559            "margin-left": "1px",
560            "margin-right": "1px",
561            'max-width':(width)+'px'
562          });
563        }else if( currentImg.hasClass('AlpinePhotoTiles-img-noshadow') ){
564          currentImg.removeClass('AlpinePhotoTiles-img-noshadow');
565          currentImg.css({
566            'max-width':(width)+'px',
567            "box-shadow":"none"
568          });
569        }
570        
571        if( currentImg.hasClass('AlpinePhotoTiles-img-highlight') ){
572          currentImg.removeClass('AlpinePhotoTiles-img-highlight');
573          
574          if( '4px' != currentImg.css('padding-right') ){
575            width -= 6;
576            currentImg.css({
577              'max-width':(width)+'px',
578              'padding':'2px',
579              "margin-left": "1px",
580              "margin-right": "1px"
581            });
582          }
583
584          currentImg.hover(function(){
585            s(this).css({
586              "background-color": options.highlight
587            });
588          },function(){
589            s(this).css({
590              "background-color": "#fff"
591            });
592          });
593        }
594      });
595    });
596  }
597    
598})( window, jQuery );

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.