1plpPublicExpand = function() { 2 lpNested = $('ul.learning_plan li ul'); 3 lpNested.hide(); 4 $('ul.learning_plan > li > a').on('click', function(e) { 5 var $this = $(this), 6 parent = $this.parent(); 7 if ($this.next('ul').is(':visible')) { 8 parent.removeClass('open').find('ul').hide() 9 } else { 10 lpNested.hide(); 11 parent.addClass('open').find('ul').show(); 12 } 13 e.preventDefault(); 14 }); 15} 16var Scroller = { 17 iStep: 5, 18 iStepMultiplier: 5, 19 iTimerDown: 0, 20 iTimerUp: 0, 21 iDelay: 40, 22 iScrollHeight: 330, 23 iHeightInitiator: 350, 24 oDiv: "readingListArea", 25 init: function() { 26 Scroller.changeButtonOpacity("scr_top", true); 27 if (document.getElementById(Scroller.oDiv)) { 28 if (document.getElementById(Scroller.oDiv).scrollHeight < Scroller.iScrollHeight) { 29 Scroller.changeButtonOpacity("scr_bottom", true); 30 } else { 31 Scroller.changeButtonOpacity("scr_bottom", false); 32 } 33 document.getElementById("scr_up").onmousedown = function() { 34 Scroller.scrollUp(); 35 Scroller.opacity(); 36 } 37 document.getElementById("scr_up").onmouseup = function() { 38 Scroller.stopScroll(); 39 Scroller.opacity(); 40 } 41 document.getElementById("scr_down").onmouseup = function() { 42 Scroller.stopScroll(); 43 Scroller.opacity(); 44 } 45 document.getElementById("scr_down").onmousedown = function() { 46 Scroller.scrollDown(); 47 Scroller.opacity(); 48 } 49 document.getElementById("scr_jump_up").onclick = function() { 50 document.getElementById(Scroller.oDiv).scrollTop -= (Scroller.iStep * Scroller.iStepMultiplier); 51 Scroller.opacity(); 52 } 53 document.getElementById("scr_jump_down").onclick = function() { 54 document.getElementById(Scroller.oDiv).scrollTop += (Scroller.iStep * Scroller.iStepMultiplier); 55 Scroller.opacity(); 56 } 57 document.getElementById("scr_top").onclick = function() { 58 document.getElementById(Scroller.oDiv).scrollTop = 0; 59 Scroller.opacity(); 60 } 61 document.getElementById("scr_bottom").onclick = function() { 62 document.getElementById(Scroller.oDiv).scrollTop = document.getElementById(Scroller.oDiv).scrollHeight; 63 Scroller.opacity(true); 64 } 65 } 66 }, 67 opacity: function(bFlag) { 68 if (document.getElementById(Scroller.oDiv).scrollTop >= (document.getElementById(Scroller.oDiv).scrollHeight - Scroller.iHeightInitiator)) { 69 Scroller.changeButtonOpacity("bottom", true); 70 } else { 71 Scroller.changeButtonOpacity("scr_bottom", false); 72 } 73 if (document.getElementById(Scroller.oDiv).scrollTop < 1) { 74 Scroller.changeButtonOpacity("scr_top", true); 75 } else { 76 Scroller.changeButtonOpacity("scr_top", false); 77 } 78 }, 79 scrollUp: function() { 80 window.clearTimeout(Scroller.iTimerDown); 81 document.getElementById(Scroller.oDiv).scrollTop -= Scroller.iStep; 82 Scroller.iTimerDown = setTimeout(function() { 83 Scroller.scrollUp(); 84 }, Scroller.iDelay); 85 }, 86 scrollDown: function() { 87 window.clearTimeout(Scroller.iTimerUp); 88 document.getElementById(Scroller.oDiv).scrollTop += Scroller.iStep; 89 Scroller.iTimerUp = setTimeout(function() { 90 Scroller.scrollDown(); 91 }, Scroller.iDelay); 92 }, 93 stopScroll: function() { 94 window.clearTimeout(Scroller.iTimerDown); 95 window.clearTimeout(Scroller.iTimerUp); 96 }, 97 changeButtonOpacity: function(sButtonSet, bFlag) { 98 if (sButtonSet === "scr_top" && bFlag) { 99 $('#scr_up, #scr_jump_up, #scr_top').css("opacity", 0.5); 100 } 101 if (sButtonSet === "scr_top" && !bFlag) { 102 $('#scr_up, #scr_jump_up, #scr_top').css("opacity", 1); 103 } 104 if (sButtonSet === "scr_bottom" && bFlag) { 105 $('#scr_down, #scr_jump_down, #scr_bottom').css("opacity", 0.5); 106 } 107 if (sButtonSet === "scr_bottom" && !bFlag) { 108 $('#scr_down, #scr_jump_down, #scr_bottom').css("opacity", 1); 109 } 110 } 111} 112 113function plpGlideBox(div_id) { 114 var ww, wh, scroll, bw, bh, min_top_offset, current_offset, distance_from_footer; 115 var bIE = false; 116 var $box = $("#" + div_id); 117 distance_from_footer = 180; 118 119 function windowDimensions() { 120 wh = $(window).height(); 121 } 122 123 function windowScroll() { 124 scroll = $(window).scrollTop(); 125 } 126 127 function boxDimensions() { 128 bh = $box.height(); 129 } 130 131 function fixPosition() { 132 var footer_offset = $("#footer").offset().top; 133 if (scroll > min_top_offset) { 134 var top = 10; 135 if (bIE) { 136 top += scroll; 137 } 138 if (scroll + bh > footer_offset) { 139 top -= (bh - footer_offset + distance_from_footer); 140 if (bIE) { 141 top -= scroll; 142 } 143 $box.stop().css({ 144 "position": "absolute",
145 "top": top 146 }); 147 } else { 148 $box.stop().css({ 149 "position": "fixed", 150 "top": top 151 }); 152 } 153 } else { 154 $box.stop().removeAttr("style"); 155 } 156 } 157 if ($box.size() == 1) { 158 min_top_offset = $box.offset().top; 159 current_offset = min_top_offset - 10; 160 $(window).scroll(function() { 161 boxDimensions(); 162 windowScroll(); 163 fixPosition(); 164 }); 165 $(window).resize(function() { 166 windowDimensions(); 167 fixPosition(); 168 }); 169 $box.resize(function() { 170 boxDimensions(); 171 fixPosition(); 172 }); 173 boxDimensions(); 174 windowScroll(); 175 windowDimensions(); 176 fixPosition(); 177 } 178} 179 180function plpPlusMinusBtns() { 181 $(".plp_plusminus_btn,.left_hand_remove_btn,.complete_btn").unbind("click"); 182 $(".plp_plusminus_btn,.left_hand_remove_btn,.complete_btn").click(function(event) { 183 event.preventDefault(); 184 if (readCookie('plp_public') == null) { 185 createCookie('plp_public', '', 1); 186 } 187 newUser(); 188 var plp_btn_data = $(this).data(); 189 var proc_url = plp_btn_data.url.replace(/\//g, '|'); 190 var plp_var = 'action:' + plp_btn_data.action + ',' + 'url:' + proc_url; 191 $.ajax({
192 url: '/pages/ajax/plpaddremove/' + plp_var, 193 success: function(data) { 194 var data_split = data.split('|'); 195 $('#readingListArea').html(data_split[0]); 196 moveToMostRecent(); 197 var cookie_val = data_split[1] + '|' + data_split[3]; 198 createCookie('plp_public', cookie_val, 1); 199 if (data_split[2] == 'max_limit') { 200 $.colorbox({ 201 inline: true, 202 width: "50%", 203 height: "400px", 204 scrolling: false, 205 href: "#plp_public_signin_popup" 206 }); 207 } else { 208 if (plp_btn_data.action == 'add' && $("span[data-url='" + plp_btn_data.url + "']")) { 209 $("span[data-url='" + plp_btn_data.url + "']").data().action = 'remove'; 210 $("span[data-url='" + plp_btn_data.url + "']").removeClass('plp_plus'); 211 $("span[data-url='" + plp_btn_data.url + "']").addClass('plp_minus'); 212 } else { 213 $("span[data-url='" + plp_btn_data.url + "']").data().action = 'add'; 214 $("span[data-url='" + plp_btn_data.url + "']").removeClass('plp_minus'); 215 $("span[data-url='" + plp_btn_data.url + "']").addClass('plp_plus'); 216 } 217 if ($("#readingListArea").height()) {} 218 } 219 plpPlusMinusBtns(); 220 } 221 }); 222 }); 223} 224 225function moveToMostRecent() { 226 if ($("#readingListArea").children().last().offset() != undefined) { 227 var scrollto = $("#readingListArea").children().last().offset().top - $('#readingListArea').offset().top - 20; 228 $('#readingListArea').animate({ 229 scrollTop: scrollto + 'px' 230 }, 1000, function() { 231 $('body').css('cursor', 'default'); 232 }); 233 } 234} 235 236function getUrlVars() { 237 var vars = {}; 238 var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) { 239 vars[key] = value; 240 }); 241 return vars; 242} 243 244function newUser() { 245 if (readCookie('plp_public') == '') { 246 $.colorbox({ 247 inline: true, 248 width: "50%", 249 height: "400px", 250 scrolling: false, 251 href: "#plp_public_signin_popup" 252 }); 253 } else { 254 $.colorbox.remove(); 255 } 256} 257 258function plpSignIn() { 259 $('.provider_link').click(function() { 260 window.open($(this).attr('href'), 'title', 'width=800, height=500'); 261 return false; 262 }); 263 $('#plp_signup_email_yes').click(function(e) { 264 e.preventDefault(); 265 if ($('#plp_email').val() == '') { 266 alert('We need an email address'); 267 } else { 268 $.ajax({
269 url: '/pages/ajax/addemail/' + $('#plp_email').val(), 270 success: function(data) { 271 data = $.trim(data); 272 if (data == 'true') { 273 moveToNextStage(3); 274 } 275 } 276 }); 277 } 278 return false; 279 }); 280 $('#plp_register_cancel').click(function(e) { 281 e.preventDefault(); 282 $.colorbox.close(); 283 return false; 284 }); 285 $('#plp_signup_email_no').click(function(e) { 286 e.preventDefault(); 287 $.colorbox.close(); 288 return false; 289 }); 290 $('#plp_signup_nl_yes').click(function(e) { 291 e.preventDefault(); 292 $.ajax({ 293 url: '/pages/ajax/adduser/true', 294 success: function(data) { 295 data = $.trim(data); 296 if (data == 'true') { 297 moveToNextStage(4); 298 } else {} 299 } 300 }); 301 return false; 302 }); 303 $('#plp_signup_nl_no').click(function(e) { 304 e.preventDefault(); 305 $.ajax({
306 url: '/pages/ajax/adduser/false', 307 success: function(data) { 308 data = $.trim(data); 309 if (data == 'true') { 310 moveToNextStage(4); 311 } 312 } 313 }); 314 return false; 315 }); 316} 317 318function createCookie(name, value, days) { 319 if (days) { 320 var date = new Date(); 321 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 322 var expires = "; expires=" + date.toGMTString(); 323 } else var expires = ""; 324 document.cookie = name + "=" + value + expires + "; path=/"; 325} 326 327function readCookie(name) { 328 var nameEQ = name + "="; 329 var ca = document.cookie.split(';'); 330 for (var i = 0; i < ca.length; i++) { 331 var c = ca[i]; 332 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 333 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 334 } 335 return null; 336} 337 338function eraseCookie(name) { 339 createCookie(name, "", -1); 340} 341 342function refreshParent(stage) { 343 if (stage == null) { 344 additional = ''; 345 stage = 0; 346 } else { 347 additional = '?login_process=go&stage=' + stage; 348 } 349 if (window.opener) { 350 if (window.opener.progressWindow) { 351 window.opener.progressWindow.close() 352 } 353 window.onbeforeunload = function(e) { 354 window.opener.moveToNextStage(stage); 355 }; 356 window.close(); 357 } 358} 359 360function moveToNextStage(stage) { 361 if (stage == 0) { 362 $.colorbox.close(); 363 return; 364 } 365 if (stage == 2) { 366 if (stored_email != null) { 367 stage = 3; 368 } else {} 369 } 370 var scrollto = (stage - 1) * 320; 371 $('#plp_public_signup').animate({ 372 top: -scrollto 373 }, 1000); 374} 375stored_email = null; 376 377function storeEmail(email) { 378 if (window.opener) { 379 window.opener.stored_email = email; 380 } 381}
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.