1$(document).ready(function () { 2 $.ajaxSetup({ cache: false }); 3}); 4 5var NewsModule = (function () { 6 7 var postReaction = function (html) { 8 $('#newsReaction').html(html); 9 10 toggleReactionButton(); 11 clearReactionFields(); 12 }; 13 14 var toggleReactionButton = function () { 15 $('#news-content #submitreaction').toggle(); 16 }; 17 18 var clearReactionFields = function () { 19 $('#news-content #reactionForm input[type=text], #news-content #reactionForm textarea').val(''); 20 }; 21 22 23 var init = function () { 24 25 $("#largeMedia .video").each(function () { 26 var $this = $(this); 27 $this.parent().attr("href", "javaScript:void(0);") 28 $this.parent().removeAttr("target"); 29 var url = $this.data('video'); 30 var id = $this.attr('id'); 31 var thumb = $this.data('thumb'); 32 33 writeFlash(url, id, thumb); 34 }); 35 36 var $sliderElement = $('#largeMedia'); 37 38 39 $('#news-content').on('click', '.reactionsNavigation a', function (e) { 40 e.preventDefault(); 41 42 var url = $(this).attr('href'); 43 $.get(url, function (html) { 44 $('#newsReaction').html(html); 45 }); 46 }); 47 48 $('#sendNews').click(function (event) { 49 event.preventDefault(); 50 event.stopPropagation(); 51 window.open($(this).attr('href'), 'sendNews', 'menubar = no, location = no, resizable = no, width = 625, height = 500'); 52 return false; 53 }); 54 55 $('#printNews').click(function (event) { 56 event.preventDefault(); 57 event.stopPropagation(); 58 window.open($(this).attr('href')); 59 return false; 60 }); 61 62 $('#news-content #largeMedia .image').each(function () { 63 $(this).closest("a").photoStyle(); 64 }); 65 66 67 68 $sliderElement.slick({ 69 autoplay: true, 70 autoplaySpeed: 5000, 71 draggable: false, 72 dots: false, 73 arrows: true, 74 pauseOnHover: true 75 }); 76 77 78 $("#media li").click(function () { 79 $sliderElement.slick('slickGoTo', $(this).data("index")); 80 }); 81 82 $sliderElement.on("afterChange", function () { 83 if ($(".media.video").length > 0) { 84 //If an user clicks on a navigation key while the video is playing, pause the video 85 if (jwplayer().getState() === "playing") { 86 jwplayer().pause(); 87 } 88 $sliderElement.slick('slickPlay'); 89 } 90 }); 91 92 function writeFlash(url, id, thumbImage) { 93 jwplayer.key = "Cl9L4fx+H+2LZekHIU192Y7PCeIGKiAo9DtjKA=="; 94 95 var settings = { 96 file: url, 97 width: $('#largeMedia').width(), 98 height: $('#largeMedia').height(), 99 image: thumbImage 100 }; 101 var player = jwplayer(id); 102 player.setup(settings); 103 104 player.on("play", function () { 105 $('#largeMedia').slick('slickPause'); 106 $('#largeMedia').find('.slick-list').off('mouseleave.slick'); 107 }); 108 109 player.on("buffer", function () { 110 $('#largeMedia').slick('slickPause'); 111 $('#largeMedia').find('.slick-list').off('mouseleave.slick'); 112 }); 113 114 player.on("complete", function () { 115 $('#largeMedia').slick('slickPlay'); 116 }); 117 } 118 }; 119 120 $(document).ready(function () { 121 init(); 122 }); 123 124 return { 125 postReaction: postReaction, 126 toggleReactionButton: toggleReactionButton, 127 clearReactionFields: clearReactionFields 128 }; 129})(); 130 131 132function ellipsis(e) { 133 var w = e.width() - 10000; 134 var t = e.html(); 135 136 e.html('<span>' + t + '</span>'); 137 e = e.children(":first"); 138 139 while (t.length > 0 && e.width() >= w) { 140 t = t.substr(0, t.length - 1); 141 e.html(t + '...'); 142 } 143} 144 145jQuery.fn.imageFix = function () { 146 $(this).each(function () { 147 var img = $(this); 148 149 var parentWidth = $('#largeMedia').width(); 150 var parentHeight = $('#largeMedia').height(); 151 152 var width = img.width();
153 var height = img.height(); 154 155 //`this` refers to the jQuery object, that object always is an array 156 //to refer to the DOM object we need to do `this[0]` 157 if (img[0].naturalWidth) { width = img[0].naturalWidth; } 158 if (img[0].naturalHeight) { height = img[0].naturalHeight; } 159 160 var topOffset = 0; 161 if (height < parentHeight) { 162 topOffset = (parentHeight - height) / 2; 163 } else if (height > parentHeight) { 164 topOffset = (height - parentHeight) / 2; 165 } 166 167 var leftOffset = 0; 168 if (width < parentWidth) { 169 leftOffset = (parentWidth - width) / 2; 170 } else if (width > parentWidth) { 171 leftOffset = (width - parentWidth) / 2; 172 } 173 174 img.css({ 175 'margin-top': parseInt(topOffset, 10) + 'px', 176 'margin-left': parseInt(leftOffset, 10) + 'px' 177 }); 178 }); 179};
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.