1(function($){ 2 "use strict"; 3 4 var dummyTip; 5 6 function reBindScripts(){ 7 $('a.mxyt-lightbox').lightcase({ 8 iframe: {'allowfullscreen':true} 9 }); 10 11 $('.mxyt-tip').each(function(index, element) { 12 var $this = $(this); 13 var mainContainer = $this.closest('.mxYouTubeR'); 14 var _class = ''; 15 var matches = mainContainer.attr('class').match(/(mxYouTubeR_theme_[a-z0-9\-_]+)/); 16 if(matches && matches.length>0){ 17 _class = matches[0]; 18 } 19 20 $this.off('mouseenter'); 21 $this.on('mouseenter',function(){ 22 if(!dummyTip.hasClass(_class)){ 23 dummyTip.addClass(_class); 24 } 25 dummyTip.children('span').html($this.attr('title')); 26 var pos = $this.offset(); 27 dummyTip.css('left',pos.left+$this.innerWidth()/2-dummyTip.width()/2); 28 dummyTip.css('top',pos.top); 29 30 dummyTip.addClass('active'); 31 dummyTip.stop().css('opacity',0).animate({ 32 'opacity': 0.9, 33 'margin-top': -25 34 },200,'swing',function(){ 35 //console.info(tip,this); 36 }); 37 }); 38 $this.off('mouseleave'); 39 $this.on('mouseleave',function(){ 40 dummyTip.removeClass(_class); 41 dummyTip.removeClass('active'); 42 dummyTip.css('margin-top',-15); 43 }); 44 }); 45 } 46 47 var playlistLoader = { 48 loading: false, 49 pageToken: '', 50 button: null, 51 loadingBar: null, 52 params: {}, 53 target: null, 54 55 bind: function(jqBtn){ 56 this.button = jqBtn; 57 this.pageToken = jqBtn.attr('data-mxyt-pagetoken'); 58 this.params = jqBtn.attr('data-mxyt-cfg'); 59 this.target = jqBtn.closest('.mxYouTubeR').find('.mxyt-playlist'); 60 }, 61 loadMore: function(jqBtn){ 62 if(this.loading){ 63 return false; 64 } 65 this.bind(jqBtn); 66 if(this.pageToken==''){ 67 return false; 68 } 69 this.loading = true; 70 this.loadingBar = $('<i class="mxyt-icon mxyt-icon-spinner"></i>'); 71 this.button.hide(); 72 this.button.parent().append(this.loadingBar); 73 74 var loader = this; 75 $.ajax({ 76 url: mxyt_ajax_object.ajax_url, 77 type: 'post', 78 dataType: "json", 79 data:{ 80 action: 'mxyoutuber', 81 pageToken: loader.pageToken, 82 params: loader.params, 83 }, 84 success: function( result ){ 85 if(result.success){ 86 loader.loaded(result); 87 } 88 else{ 89 alert('mxYouTubeR ajax error.'); 90 } 91 }, 92 error: function(){ 93 alert('mxYouTubeR ajax error.'); 94 } 95 }); 96 }, 97 loaded: function(result){ 98 this.pageToken = result.pageToken; 99 this.loading = false; 100 this.loadingBar.remove(); 101 this.button.attr('data-mxyt-pagetoken',this.pageToken); 102 if(this.pageToken){ 103 this.button.show(); 104 } 105 var items = $(result.html).find('.mxyt-row'); 106 this.target.append(items); 107 reBindScripts(); 108 items.css('opacity',0); 109 items.stop().animate({ 110 'opacity': 1 111 },300); 112 } 113 }; 114 115 $(document).ready(function(e) { 116 117 dummyTip = $('<div id="mxyt-tooltip" class="mxyt-tooltip"><span></span><div></div></div>'); 118 $('body').append(dummyTip); 119 120 reBindScripts(); 121 122 $('.mxyt-load-more').each(function(index, element) { 123 var $this = $(this); 124 if($this.hasClass('mxyt-infinite-scroll')){ 125 $(window).on('scroll',function(){ 126 var top = $(window).scrollTop() + $(window).height(); 127 if(top>$this.offset().top){ 128 playlistLoader.loadMore($this); 129 } 130 }); 131 } 132 else{ 133 $this.on('click',function(){ 134 playlistLoader.loadMore($(this)); 135 return false; 136 }); 137 } 138 }); 139 }); 140 141})(jQuery); 142 143 144 145 146 147 148
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.