1/* Declare variables we need */ 2// reset on initial load 3 delete window.nofoundphone; 4 delete window.modaltoshow; 5/* for main-data */ 6 7/* Note: pathprefix defined previously */ 8var loadurl = pathprefix+'inc/loaddata'; // URL is relative to location of current file, sans extension so we don't cause a 302 9var saveurl = pathprefix+'inc/storethis'; // URL is relative to location of current file, sans extension so we don't cause a 302 10// var booktitleidx = ''; This is replaced by bookname, which is defined in book 11var formvals = ''; 12var currentmodal; // global var to hold name of editModal after save 13/* Variables we need for saving of croppie images */ 14var imageobj = {}; // initialize image array 15var whichimg = $('#ah-profile-image, #ah-bookcover'); // two images that can be edited 16var saveimageurl = pathprefix+'inc/saveimage'; // URL is relative to location of current file, sans extension so we don't cause a 302 17 18/* end of variable declaration */ 19 20$.when( 21 $.getScript('js/sub-create-modal.js'), 22 $.getScript('js/sub-load-biblet.js'), 23 $.getScript('js/sub-cropping-widget.js'), 24 $.getScript('js/sub-domain-suffix.js'), 25 $.getScript('js/sub-register-summernote.js'), 26 $.getScript('js/sub-build-rte.js'), 27 $.getScript('js/sub-book-rearrange.js'), 28 $.getScript('js/sub-slider.js'), 29 $.getScript('js/sub-load-contact.js'), 30 $.getScript('js/sub-common.js'), 31 $.getScript('js/sub-other.js'), 32 33 $.Deferred( function(deferred) { 34 $(deferred.resolve); 35 }) 36).done( function() { 37 38 $('#login-form').submit(function (e) { 39 40 e.preventDefault(); 41 var senddata = $(this).serializeArray(); 42 43 $.ajax({ 44 url: 'inc/requests/login.php', 45 type: 'POST', 46 data: senddata, 47 dataType: 'json', 48 success: function(data) { 49 50 console.log(data); 51 52 // Response status codes 53 // "epdm" - Email or password does not match 54 // "enc" - Email is not confirmed 55 // "ls" - Login successful 56 57 var status_code = data['status_code']; 58 59 if (status_code == 'enc') { 60 $('#logInModal #statusmsg').fadeIn(100).text('Email not confirmed'); 61 } 62 else if (status_code == 'epdm') { 63 $('#logInModal #statusmsg').fadeIn(100).text('Login failed'); 64 } 65 else if (status_code == 'mpnc') { 66 $('#logInModal #statusmsg').fadeIn(100).text('').append('Mobile phone not confirmed. <a href="javascript:retrymobile();">RETRY</a> mobile phone confirmation?'); 67 } 68 else if (status_code == 'udis') { 69 $('#logInModal #statusmsg').fadeIn(100).text('Unable to login. Please contact us.'); 70 } 71 else if (status_code == 'ls') { 72 $('#logInModal').modal('hide'); 73 // $('body').addClass('editable'); 74 75 $('#authenticationModal').modal('show'); 76 $('#part-of-phone-number').text(data['phone_number']); 77 78 // window.location.href = 'https://user.authorhomepage.com'; 79 } 80 }, 81 error: function (error) { 82 console.log(error); 83 } 84 }); 85 }); 86 87 $('#2fa-form').submit(function (e) { 88 console.log('authenticate clicked'); 89 redirectURL = 'https://user.authorhomepage.com'; 90 if ($('#2fa-form .btn-mod').length > 0) { 91 e.preventDefault(); 92 // redirect, since submit button now works as an OK button 93 // window.location.href = redirectURL; 94 } 95 else { 96 e.preventDefault(); 97 var senddata = $(this).serializeArray(); 98 99 $.ajax({ 100 url: 'inc/requests/2fa.php', 101 type: 'POST', 102 data: senddata, 103 success: function(data) { 104 console.log(data); 105 if (data != '') { 106 if (data.substring(0,1) == '1') { 107 $('#authenticationModal #statusmsg').fadeIn(100).text('Wrong 2FA code'); 108 } else if (data.substring(0,1) == '2') { 109 $('#authenticationModal #statusmsg').fadeIn(100).text('Verification code expired'); 110 } else if (data.substring(0,1) == '0') { 111 if (window.location.search.indexOf('email_confirm') > -1) { 112 $('#authenticationModal #statusmsg').fadeIn(100).html('Sign up process complete.<br /><br />Please wait while we configure your web server and build your website.<br /><br />You will be notified as soon as you can log in and customize your content!'); 113 $('#authenticationModal .formFields > *').remove(); 114 $('#authenticationModal .formFields').html('<div class="form-group"><button class="btn btn-default btn-block hide-modal btn-mod">Done</button></div>'); 115 //window.location.href = redirectURL; 116 } 117 else { 118 $('#authenticationModal #statusmsg').fadeIn(100).html('You are logged in!'); 119 $('#authenticationModal .formFields > *').remove(); 120 $('#authenticationModal .formFields').html('<div class="form-group"><button class="btn btn-default btn-block hide-modal">Done</button></div>'); 121 redirectURL = data.substring(1); 122 //console.log(redirectURL); 123 //console.log(window.location.href); 124 if (redirectURL + '/' == window.location.href) { 125 // we are logging in from user's website 126 location.reload(true); 127 } else { 128 // we are starting from biz website, so redirect 129 setTimeout(function () { 130 window.location.href = redirectURL; 131 }, 500); 132 } 133 } 134 } 135 } // end of data !='' 136 }, 137 error: function (error) { 138 console.log(error); 139 } 140 }); 141 } 142 }); 143 144 145 // Function that extracts get parameters 146 var getURLParameter = function getURLParameter(sParam) { 147 var sPageURL = window.location.search.substring(1), 148 sURLVariables = sPageURL.split('&'), 149 sParameterName, 150 i; 151 152 for (i = 0; i < sURLVariables.length; i++) { 153 sParameterName = sURLVariables[i].split('='); 154 155 if (sParameterName[0] === sParam) { 156 return sParameterName[1] === undefined ? true : decodeURIComponent((sParameterName[1]+'').replace(/\+/g, '%20')); // replace + with space 157 } 158 } 159 }; 160 161 // Store signup URL get parameters 162 var paramTxnCode = getURLParameter('txncode'); 163 var paramEmail = getURLParameter('email');
164 var paramName = getURLParameter('name'); 165 var paramAgency = getURLParameter('agencycode'); 166 // Not needed any more 167 var paramCOUID = getURLParameter('couid'); 168 var paramOrdernum = getURLParameter('ordernum'); 169 var paramCustProd = getURLParameter('customer_prod_activ_uid'); 170 var paramSku = getURLParameter('sku'); 171 var paramQty = getURLParameter('quantity'); 172 173 // If at least one parameter exist 174 if (!!paramCOUID || !!paramEmail || !!paramName) { 175 176 // Show the signup modal 177 $('#signUpModal').modal(); 178 179 // And prefill the fields with values from the URL 180 $('#signUpModal input[name=s_email]').val(paramEmail); 181 $('#signUpModal input[name=s_miemail]').val(paramEmail); 182 $('#signUpModal input[name=s_name]').val(paramName); 183 $('#signUpModal input[name=s_txncode]').val(paramTxnCode); 184 $('#signUpModal input[name=s_agencycode]').val(paramAgency); 185 // set mobile phone to match agency code 186 if ($('#s_agencycode').val().length > 0) { 187 $('#signUpModal select[name=s_countrycode]').val(paramAgency); 188 } 189 // Not needed any more 190 $('#signUpModal input[name=s_couid]').val(paramCOUID); 191 $('#signUpModal input[name=s_ordernum]').val(paramOrdernum); 192 $('#signUpModal input[name=s_customer_prod_active_uid]').val(paramCustProd); 193 $('#signUpModal input[name=s_sku]').val(paramSku); 194 $('#signUpModal input[name=s_qty]').val(paramQty); 195 } 196 197 $('#signup-form').submit(function (e) { 198 199 e.preventDefault(); 200 if($('#signup-form .btn-mod').length > 0) { 201 // do nothing, since submit button now works as an OK button 202 } else { 203 // Not needed any more 204 /* 205 // If there is no COUID in the URL, 206 // fill the "s_couid" hidden field with 0, 207 // because it's a required field 208 if ($('#s_couid').val().length === 0) { 209 var tempCOUID = 0; 210 $('#s_couid').val(tempCOUID); 211 } 212 // If there is no AGENCYCODE in the URL, 213 // fill the "s_agencycode" hidden field with USA, 214 // because it's a required field 215 if ($('#s_agencycode').val().length == 0) { 216 var tempAGENCYCODE = 'USA'; 217 $('#s_agencycode').val(tempAGENCYCODE);
218 } 219 */ 220 var formData = $(this).serializeArray(); 221 222 $.ajax({ 223 url: 'inc/requests/signup.php', 224 type: 'POST', 225 data: formData, 226 success: function(data) { 227 if (data != '') { 228 try { 229 var obj = $.parseJSON(data); 230 if (obj.sent) { 231 $('#signUpModal #statusmsg').fadeIn(100).html('Sign up initiated!<br><br>You should receive an email requesting confirmation.<br><br>If you don\'t, contact us at <a href="mailto:[email protected]">[email protected]</a>'); 232 $('#signUpModal .formFields > *').remove(); 233 $('#signUpModal .formFields').html('<div class="form-group"><button class="btn btn-default btn-block hide-modal btn-mod">Done</button></div>'); 234 } 235 } 236 catch (e) { 237 $('#signUpModal #statusmsg').fadeIn(100).html(data); 238 } 239 } 240 else { 241 $('#signUpModal #statusmsg').fadeIn(100).html('Sign up failed'); 242 } 243 }, 244 error: function (error) { 245 console.log(error); 246 } 247 }); 248 } 249 }); 250 251 $('#forgot-password-form').submit(function (e) { 252 253 e.preventDefault(); 254 if($('#forgot-password-form .btn-mod').length > 0) { 255 // do nothing, since submit button now works as an OK button 256 } else { 257 var senddata = $(this).serializeArray(); 258 259 $.ajax({ 260 url: 'inc/requests/forgot-password.php', 261 type: 'POST', 262 data: senddata, 263 success: function(data) { 264 if (data != '') { 265 if (data.substring(0,1) == '1') { 266 $('#forgotPassModal #statusmsg').fadeIn(100).html('Email address is required'); 267 } else if (data.substring(0,1) == '2') { 268 $('#forgotPassModal #statusmsg').fadeIn(100).html('Email address is not valid'); 269 } else if (data.substring(0,1) == '3') { 270 $('#forgotPassModal #statusmsg').fadeIn(100).html('Email must contain at most 50 characters'); 271 } else if (data.substring(0,1) == '4') { 272 $('#forgotPassModal #statusmsg').fadeIn(100).html('Email address you entered was not found or is inactive'); 273 } else if (data.substring(0,1) == '0') { 274 $('#forgotPassModal #statusmsg').fadeIn(100).html('Reset instructions have been sent to your email.'); 275 $('#forgotPassModal .formFields > *').remove(); 276 $('#forgotPassModal .formFields').html('<div class="form-group"><button class="btn btn-default btn-block hide-modal btn-mod">Done</button></div>'); 277 // console.log('success'); 278 } else { 279 $('#forgotPassModal #statusmsg').fadeIn(100).html('Error processing request. Please rety'); 280 $('#forgotPassModal .formFields > *').remove(); 281 $('#forgotPassModal .formFields').html('<div class="form-group"><button class="btn btn-default btn-block hide-modal btn-mod">Retry</button></div>'); 282 } 283 } 284 }, 285 error: function (error) { 286 console.log(error); 287 } 288 }); 289 } 290 }); 291 292 $('.modal .formFields').on('click', '.hide-modal', function(event) { 293 $(this).parents('.modal').modal('hide'); 294 }); 295 $('.modal .formFields').on('click', '.show-login', function(event) { 296 $(this).parents('.modal').modal('hide'); 297 $('#logInModal').modal('show'); 298 }); 299 300 $('#reset-password-form').submit(function (e) { 301 302 e.preventDefault(); 303 if($('#reset-password-form .btn-mod').length > 0) { 304 // do nothing, since submit button now works as an OK button 305 } else { 306 var senddata = $(this).serializeArray(); 307 308 $.ajax({ 309 url: 'inc/requests/reset-password.php', 310 type: 'POST', 311 data: senddata, 312 success: function(data) { 313 314 if (data != '') { 315 if (data.substring(0,1) == '1') { 316 $('#reset-password-form #statusmsg').fadeIn(100).html('<p>Password is required!</p>'); 317 } 318 else if (data.substring(0,1) == '2') { 319 $('#reset-password-form #statusmsg').fadeIn(100).html('<p>Password must contain at least 8 characters!</p>'); 320 } 321 else if (data.substring(0,1) == '3') { 322 $('#reset-password-form #statusmsg').fadeIn(100).html('<p>Password must contain less than 32 characters!</p>'); 323 } 324 else if (data.substring(0,1) == '4') { 325 $('#reset-password-form #statusmsg').fadeIn(100).html('<p>Passwords must match!</p>'); 326 } 327 else if (data.substring(0,1) == '5') { 328 $('#reset-password-form #statusmsg').fadeIn(100).html('<p>Unable to reset password.</p>'); 329 } 330 else if (data.substring(0,1) == '6') { 331 $('#reset-password-form #statusmsg').fadeIn(100).html('<p>Password reset expired. Try a new request.</p>'); 332 } 333 else if (data.substring(0,1) == '0') { 334 $('#reset-password-form #statusmsg').fadeIn(100).html('<p>Password reset successful!</p>'); 335 $('#resetPassModal .formFields > *').remove(); 336 $('#resetPassModal .formFields').html('<div class="form-group"><button class="btn btn-default btn-block btn-mod show-login">Login</button></div>'); 337 // Eliminate querystring 338 window.history.replaceState({}, document.title, "/"); 339 // wipe out modal variable so we show login
340 delete window.modaltoshow; 341 } 342 } 343 else { 344 console.log('fail'); 345 } 346 }, 347 error: function (error) { 348 console.log(error); 349 } 350 }); 351 } 352 353 }); 354 355 356 function compare(a,b) { 357 if (a.slideorder < b.slideorder) 358 return -1; 359 if (a.slideorder > b.slideorder) 360 return 1; 361 return 0; 362 } 363 364 $.ajax({ 365 type: 'POST', 366 url: 'inc/requests/get-slider.php', 367 success: function(data) { 368 if (data) { 369 // console.log('success'); 370 var obj = JSON.parse(data); 371 372 var slidesArr = obj.sort(compare); 373 //console.log(slidesArr); 374 if(slidesArr.length > 0) { 375 if ($('body').hasClass('edit-slideshow')) { 376 $('#slotsWrapper').html(''); 377 slidesArr.forEach(function(slide, index) { 378 populateEditSlideshow(slide, index); 379 380 }); 381 382 } else if ($('body').hasClass('index')) { 383 384 slidesArr = slidesArr.filter(function( slide ) { 385 return slide.active == '1'; 386 }); 387 //console.log(slidesArr); 388 //main slider remove excess slides 389 390 if (slidesArr.length == 0) { 391 $('#fancySlider-main').addClass('noSlides'); 392 $('.sl-slider').remove(); 393 394 } else { 395 if ($('#fancySlider-main .sl-slide').length > slidesArr.length) { 396 var numOfExcessSlides = $('#fancySlider-main .sl-slide').length - slidesArr.length; 397 var excessSlides = $('#fancySlider-main .sl-slide').slice(-numOfExcessSlides); 398 excessSlides.remove(); 399 } 400 slidesArr.forEach(function(slide, index) { 401 populateMainSlider(slide, index); 402 403 }); 404 } 405 } 406 cloudinaryOn(); 407 } 408 409 } 410 else { 411 console.log('fail'); 412 } 413 }, 414 error: function (error) { 415 console.log(error); 416 } 417 }); 418 419 $('#editSlideshowSave').click(function(e) { 420 e.preventDefault(); 421 422 var senddata = []; 423 var slides = $('#slotsWrapper .slideSlot'); 424 425 for ( var i = 0; i < slides.length; i++) { 426 var slideId = $(slides[i]).attr('id'); 427 var slideOrder = i.toString(); 428 var slideImg = $(slides[i]).find('.slideImgPlaceholder img').attr('src'); 429 var slideTxtAlign = $(slides[i]).find('.txtPlacement input:checked').val(); 430 var slideTxt = $(slides[i]).find('.textEditor').summernote('code'); 431 var slideTxtAnim = $(slides[i]).find('.animationDropdown').val(); 432 var slideType = $(slides[i]).find('.sidetab.active').attr('class').split(' ')[0]; 433 var slideActive; 434 $(slides[i]).find('.activateSlide input.activate').prop('checked') ? slideActive = 1 : slideActive = 0; 435 436 var coverImg = $(slides[i]).find('.coverImg img').attr('src'); 437 438 senddata.push({'id': slideId, 'slideorder': slideOrder, 'imageurl': slideImg, 'leftalign': slideTxtAlign, 'slidetext': slideTxt, 'textanimation': slideTxtAnim, 'active': slideActive.toString(), 'slidetype': slideType, 'coverurl': coverImg}); 439 440 } 441 senddata = JSON.stringify(senddata); 442 443 $.ajax({ 444 url: 'inc/requests/set-slideshow.php', 445 type: 'POST', 446 data: senddata, 447 success: function(data) { 448 console.log(data); 449 if (data) { 450 console.log('success'); 451 452 $('#successfulSave').modal('show'); 453 setTimeout(function() { 454 $('#successfulSave').modal('hide'); 455 }, 3000); 456 } 457 else { 458 459 460 console.log('fail'); 461 } 462 }, 463 error: function (error) { 464 console.log(error); 465 } 466 }); 467 }); 468 469 $.ajax({ 470 type: 'POST', 471 url: 'inc/requests/get-slider.php?data=categories', 472 success: function(data) { 473 if (data) { 474 var obj = JSON.parse(data); 475 476 obj.forEach(function(obj) { 477 var catName = obj.category.replace(/ /g, "-").toLowerCase(); 478 479 $('#galleryModal #nav-gallery').append('<a class="categoryItem nav-link" data-toggle="pill" href="#nav-'+ catName +'" role="tab" aria-controls="nav-'+ catName +'" aria-selected="false"><span>' + obj.category + '</span></a>') 480 $('#galleryModal #nav-tabContent').append('<div class="tab-pane fade" id="nav-'+ catName +'" role="tabpanel" aria-labelledby="nav-'+ catName +'-tab"></div>'); 481 }); 482 483 $('#galleryModal #nav-gallery .categoryItem').eq(0).addClass('active').attr('aria-selected', 'true'); 484 $('#galleryModal #nav-tabContent .tab-pane').eq(0).addClass('active show'); 485 486 /*ADD HOVER ARROW IN SUBMENUS AND GALLERY CATEGORIES*/ 487 488 $('#submenu > ul > li > ul > li a, #editSettings > ul > li > a, #galleryModal .categoryItem').append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17.062 11.997"><defs><style>.cls-1 {fill: #ffde00;}</style></defs><path id="right-arrow_1_" data-name="right-arrow (1)" class="cls-1" d="M11.489,4.854a.6.6,0,0,0-.86.851l4.36,4.36H.6a.6.6,0,0,0-.6.6.606.606,0,0,0,.6.611H14.99l-4.36,4.352a.617.617,0,0,0,0,.86.6.6,0,0,0,.86,0L16.882,11.1a.592.592,0,0,0,0-.851Z" transform="translate(0 -4.674)"/></svg>') 489 490 selectImageFromGallery(); 491 } else { 492 console.log('fail'); 493 } 494 }, 495 error: function (error) { 496 console.log(error); 497 } 498 }); 499 500 $('#galleryModal').on('click', '.categoryItem', function() { 501 var categoryName = $(this).find('span').text(); 502 var catRef = categoryName.replace(/ /g,'-').toLowerCase(); 503 var tab = $('#galleryModal #nav-tabContent .tab-pane[id="nav-'+catRef+'"]'); 504 if (tab.children().length == 0) { 505 $.ajax({
506 type: 'POST', 507 url: 'inc/requests/get-slider.php?category='+categoryName, 508 success: function(data) { 509 if(data) { 510 var obj = JSON.parse(data); 511 obj.forEach(function(image, index) { ; 512 tab.append('<div class="imgWrapper"><img src="'+ image.imglocation +'" class="img-fluid"><a href="'+ image.imglocation +'" data-toggle="lightbox" data-gallery="gallery"></a></div>') 513 }); 514 } else { 515 console.log('fail'); 516 } 517 }, 518 error: function (error) { 519 console.log(error); 520 } 521 }); 522 } 523 }); 524 525 $.ajax({ 526 type: 'POST', 527 url: 'inc/requests/get-books.php?data=covers', 528 success: function(data) { 529 530 if (data) { 531 var coverData = JSON.parse(data); 532 533 coverData.forEach(function(cover) { 534 if (cover.bookcover != '' && cover.bookcover != null) { 535 $('#coverGalleryModal .imageContainer').append('<div class="imgWrapper"><img src="'+ cover.bookcover +'" class="img-fluid"><a href="'+ cover.bookcover +'" data-toggle="lightbox" data-gallery="gallery"></a></div>') 536 } 537 538 }); 539 selectCoverFromGallery(); 540 } 541 else { 542 console.log('fail'); 543 } 544 }, 545 error: function (error) { 546 console.log(error); 547 } 548 }); 549 550 $(document).ready(function() { 551 // Trigger opening of forgot password modal 552 553 if (window.location.search.indexOf('forgot-password-modal=true') > -1) { 554 $('#resetPassModal').modal(); 555 } 556 // Trigger opening of 2FA modal after email confirmation and omce we make sure that phone number is returned 557 /* 558 if (window.location.search.indexOf('email_confirm') > -1 && (typeof window.nophonefound === 'undefined' || window.nophonefound !== true)) { 559 console.log('line 552: ' + window.nophonefound); 560 $('#authenticationModal').modal('show'); 561 } 562 */
563 if (typeof window.modaltoshow !== 'undefined') { 564 $(window.modaltoshow).modal('show'); 565 } 566 }); 567 568 $('.index #hpLogo').click(function (e) { 569 e.preventDefault(); 570 }); 571 572 573 //Edit Mode 574 $('body:not(.index) footer .content-wrapper > div').removeClass('editModeBox'); 575 $('body:not(.index) header .left-side > a > div').removeClass('editModeBox'); 576 577 $('.editModeBox').addClass('editable'); 578 $('#preview').click(function (e) { 579 e.preventDefault(); 580 $('.editable').toggleClass('editModeBox'); 581 $(this).toggleClass('removePreview'); 582 $('body').toggleClass('preview'); 583 var $el = $(this).find('span'); 584 $el.text($el.text() == "Live Preview" ? "Edit Mode": "Live Preview"); 585 $('#editSettings').toggle(); 586 587 }); 588 589 590 591 //adding language dropdown in modals 592 593 new WOW().init(); 594 595 596 $(document).ready(function() { 597 $("#meta").attr("content", "width=device-width, initial-scale=1"); 598 599 $('#switch-flat').click(function() { 600 $('#signup-form .modal-submit').toggleClass('disabled'); 601 }); 602 603 $('#submenu li.submenuItem').not(':has(a)').addClass('empty'); 604 605 if (!!$.cookie('selectedTheme')) { 606 $('body').attr('data-theme', $.cookie('selectedTheme')); 607 } 608 else if (!!$.cookie('themeData')) { 609 $('body').removeAttr('data-theme'); 610 } 611 $('body').on('click', '.theme', function(event) { 612 $('body').attr('data-theme', $(this).attr('id')); 613 $(this).addClass('active').siblings().removeClass('active'); 614 $.cookie('selectedTheme', $(this).attr('id')); 615 // store selected theme in database 616 savemodal('colorTheme'); 617 }); 618 619 $('.authentication.modal').on('shown.bs.modal', function () { 620 $(this).find('.modal-content').prepend($('#languageSupport')); 621 }); 622 623 $('#logInModal').on('shown.bs.modal', function () { 624 // check to see where which website is requesting login 625 if (isAHP()) { 626 // we are using either biz server or our server URL rather than personal domain, so allow login 627 } else { 628 // we are using personal domain, so redirect after countdown 629 $('#logInModal .formFields > *').remove(); 630 $('#logInModal #statusmsg').fadeIn(100).text('We need to redirect you to the \nAuthor Home Page login server...'); 631 var timeleft = 4; 632 var pbhtml = '<br><br><progress class="progress bg-light mx-auto" value="4" max="'+timeleft+'" id="progressBar"></progress>'; 633 $('#logInModal #statusmsg').append(pbhtml); 634 var downloadTimer = setInterval(function(){ 635 timeleft -= 1; 636 $("#progressBar").val(timeleft); 637 if(timeleft <= 0){ 638 clearInterval(downloadTimer); 639 $('#logInModal #progressBar').remove(); 640 location.replace('https://biz.authorhomepage.com?action=login'); 641 } 642 }, 1000); 643 } 644 // to be implemented 645 setRememberMe(); // allow Remember Me feature only if supported by browser 646 }); 647 648 $('body').fadeIn(50); 649 650 // $('.slideshow .slide.s01:not(:first)').css('display','none'); 651 // $('.slideshow .slide.s01:not(:first) .slide-content > *').css('opacity','0'); 652 // var timer; 653 654 // Store links Modal ADD Fields feature 655 656 // $('body').on('click', '#buylinksModal .editModeBtn', function () { 657 // var newStoreFields = '<div class="row wide"><div class="col-sm col-md-5"><div class="form-group"><label>Store Name</label><input class="form-control" value="" type="text" name="store"></div></div><div class="col-sm col-md-7"><div class="form-group"><label>Link URL</label><input class="form-control" value="" type="text" name="url"></div></div></div>'; 658 // $('#buylinksModal .formFields').append(newStoreFields); 659 660 // }) 661 662 663 664 $('body .descriptionWrapper').on('click', '.read-more', function(){ 665 $('.description').addClass('extended'); 666 $(this).children('img').css({'transform': 'rotate(-180deg)'}); 667 $(this).addClass('read-less').removeClass('read-more'); 668 }); 669 $('body .descriptionWrapper').on('click', '.read-less', function(){ 670 $('.description').removeClass('extended'); 671 $(this).children('img').css({'transform': 'rotate(0deg)'}); 672 $(this).addClass('read-more').removeClass('read-less'); 673 }); 674 675 $('body .excerptWrapper').on('click', '.read-more', function(){ 676 $('.excerpt').addClass('extended'); 677 $(this).children('img').css({'transform': 'rotate(-180deg)'}); 678 $(this).addClass('read-less').removeClass('read-more'); 679 }); 680 $('body .excerptWrapper').on('click', '.read-less', function(){ 681 $('.excerpt').removeClass('extended'); 682 $(this).children('img').css({'transform': 'rotate(0deg)'}); 683 $(this).addClass('read-more').removeClass('read-less'); 684 }); 685 $('.right-side').on('click', '.button-read-excerpt', function(){ 686 if ($('.excerpt').is(':visible')) { 687 $('.excerpt').slideUp('300'); 688 $(this).text('Read the excerpt'); 689 } 690 else { 691 $('.excerpt').slideDown('300'); 692 $(this).text('Hide the excerpt'); 693 } 694 }); 695 696 var allBooksColumns = Math.ceil($('.all-books-menu-wrapper > a').length/10); 697 var subMenuWidth = allBooksColumns * 205; 698 699 $('.all-books-menu-wrapper').css({'column-count': allBooksColumns, 'width': subMenuWidth}); 700 701 /*Fake horizontal scrolling with mouse wheel*/ 702 703 var elem = document.getElementById('scrollMenuEl'); 704 705 if (allBooksColumns < 3) { 706 707 $('.scroll-indicator-wrapper.right').css('opacity', 0); 708 } else { 709 $('.scroll-indicator-wrapper.right').css('opacity', 1); 710 } 711 712 713 714 (function() { 715 function scrollHorizontally(e) { 716 e = window.event || e; 717 var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); 718 719 elem.scrollLeft -= (delta * 30); 720 if (elem.scrollLeft >= elem.scrollWidth - elem.offsetWidth) { 721 $('.scroll-indicator-wrapper.right').css('opacity', 0); 722 } else if (elem.scrollLeft < elem.scrollWidth - elem.offsetWidth) { 723 $('.scroll-indicator-wrapper.right').css('opacity', 1); 724 } 725 726 if (elem.scrollLeft == 0) { 727 $('.scroll-indicator-wrapper.left').css('opacity', 0); 728 } else if (elem.scrollLeft > 0) { 729 $('.scroll-indicator-wrapper.left').css('opacity', 1); 730 } 731 732 if ($('#submenu > ul').is(':visible')) { 733 e.preventDefault(); 734 } 735 736 } 737 if (window.addEventListener) { 738 /*IE9, Chrome, Safari, Opera*/ 739 window.addEventListener("mousewheel", scrollHorizontally, false);
740 /*Firefox*/ 741 window.addEventListener("DOMMouseScroll", scrollHorizontally, false); 742 } else { 743 /*IE 6/7/8*/ 744 window.attachEvent("onmousewheel", scrollHorizontally); 745 } 746 })(); 747 748 749 $(".formContent").scroll(function () { 750 if ($(this).scrollTop() >= $(this)[0].scrollHeight - $(this).innerHeight()) { 751 $('#scroll-indicator-wrapper').css('opacity', 0); 752 } 753 if ($(this).scrollTop() < $(this)[0].scrollHeight - $(this).innerHeight()) { 754 $('#scroll-indicator-wrapper').css('opacity', 1); 755 } 756 }); 757 758 $('#fancySlider-main').swipe({ 759 swipeLeft:function(event, direction, distance, duration, fingerCount) { 760 if(fingerCount == 0){return;} // remove if you want mouse to trigger event // slitslider.next(); 761 762 $('.nav-arrow-next').trigger('click'); 763 }, 764 swipeRight : function(event, direction, distance, duration, fingerCount) { 765 if(fingerCount == 0){return;} // remove if you want mouse to trigger event 766 // slitslider.previous(); 767 $('.nav-arrow-prev').trigger('click'); 768 } 769 }); 770 771 $('.main-navigation > ul > li').hover( function() { 772 773 $(this).addClass('visible'); 774 $(this).find('> ul').fadeIn('fast'); 775 }, 776 function () { 777 $(this).find('> ul').fadeOut('fast'); 778 $(this).removeClass('visible'); 779 }); 780 781 var str = window.location.pathname; 782 str = str.substring(str.lastIndexOf("/") + 1); 783 784 $('.main-navigation li a').each(function(index, el) { 785 if ($(el).attr('href') == str) { 786 $(el).addClass('active'); 787 } 788 }); 789 790 var timer; 791 if (str == 'design' || str == 'about') { 792 $('#designSlideshow').mousemove(function() { 793 clearTimeout(timer); 794 795 $('.carousel-control').css('opacity', 1); 796 timer = setTimeout(function() { 797 $('.carousel-control').css('opacity', 0); 798 }, 5000); 799 }); 800 801 } 802 803 var checkitem = function() { 804 if ($('.carousel .carousel-inner .item:first-child').is('.active')) { 805 $('.carousel-control.left').addClass('disabled'); 806 } 807 else {$('.carousel-control.left').removeClass('disabled');} 808 if ($('.carousel .carousel-inner .item:last-child').is('.active')) { 809 $('.carousel-control.right').addClass('disabled'); 810 } 811 else {$('.carousel-control.right').removeClass('disabled');} 812 } 813 814 checkitem(); 815 $("#designSlideshow").on("slid.bs.carousel", "", checkitem); 816 817 var contentWrapperBackground = $('.main-content-wrapper > img').attr('src'); 818 819 $('body').append('<style>section .content-wrapper > article:after{background-image: url('+ contentWrapperBackground +');}</style>'); 820 821 822 function storeWidgetHeightCalc(multiplier, element) { 823 return Math.round($(element).parent().prev().children('.store-list-wrapper').children('ul').children('li').length / 2) * ($('.store-list-wrapper > ul > li:first-child').height() * multiplier); 824 } 825 $('.button-buy-now-wrapper').on('click', '.button-buy-now', function() { 826 if ($(this).parent().prev().children('.store-list-wrapper').find('li').length > 6) { 827 $(this).parent().prev().children('.store-list-wrapper').find('svg').show(); 828 } 829 if ($('body').hasClass('book-list')) { 830 var storeListHeight = $(this).parent().parent().height() - 70; 831 } 832 else { 833 var storeListHeight = $('.about-wrapper').height() - 70; 834 } 835 $(this).parent().prev().children('.store-list-wrapper').css({ 836 height: storeListHeight, 837 'max-height': storeWidgetHeightCalc(1.1, this) 838 }); 839 $(this).parent().prev().children('.store-list-wrapper').children('ul').css({ 840 height: storeWidgetHeightCalc(1.1, this), 841 top: 0 842 }); 843 }); 844 $('.store-list-wrapper').on('click', 'svg', function() { 845 if ($(this).is(':last-of-type')) { 846 $(this).prev().animate({ 847 top: $(this).parent().height() - $(this).prev().height() 848 }, 300); 849 } 850 else { 851 $(this).next().animate({ 852 top: 0 853 }, 300); 854 } 855 }); 856 857 $('.button-buy-now-wrapper').on('click', '.button-buy-now', function() { 858 var buyButtonsSelector = $(this).parent().prev(); 859 buyButtonsSelector.addClass('selected'); 860 setTimeout(function() { 861 buyButtonsSelector.addClass('reverse-transition'); 862 }, 2000); 863 }); 864 $('.buy-buttons').on('click', '.hide-buy-buttons', function() { 865 var buyButtonsSelector = $(this).parent(); 866 buyButtonsSelector.removeClass('selected'); 867 setTimeout(function() { 868 buyButtonsSelector.removeClass('reverse-transition'); 869 }, 2000); 870 }); 871 872 $('#signUpModal #username').focusout(function() { 873 if ($(this).val() === '.authorhomepage.com') { 874 $(this).val(''); 875 } 876 877 }); 878 $('#signUpModal #username').focusin(function() { 879 /*debugger;*/ 880 $(this).readOnlySuffix('.authorhomepage.com'); 881 }); 882 }); 883}); 884 885function retrymobile() { 886 $("#logInModal").modal("hide"); 887 $("#authenticationModal").modal("show"); 888 }
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.