PageSourceSearch

http://textcorrection.top/js/app.js

js textcorrection.top collected 2026-10-07 15:18:38 UTC 18,160 bytes, 591 lines download raw bytes

1// sample popup open on show sample ID trigger 
2var webPageNameUrl = window.location.href.split("#").pop();
3if(webPageNameUrl == 'pagescrollpostion'){
4  $('#viewOurSamplePopupModal').modal('show');
5}
6// homepage button functions
7
8//get dimensions 
9var height = $(window).height();
10var width = $(window).width();
11
12var mql = window.matchMedia("(orientation: portrait)");
13
14mql.addListener(function() {
15  location.reload(true)
16});
17
18var mobileVideoUrl = '<source src="https://d2hod3e0yf608t.cloudfront.net/papertrue-media-files/v2/mobile';
19var desktopVideoUrl = '<source src="https://d2hod3e0yf608t.cloudfront.net/papertrue-media-files/v2/desktop';
20var vidType = 'type="video/mp4">'
21if(width < 1199){
22  console.log("run mobile");
23  $(".ac-doc-type-mob-vid").append( mobileVideoUrl +'/academic-usp.mp4" '+ vidType );
24  $(".bus-doc-type-mob-vid").append( mobileVideoUrl +'/business-usp.mp4" '+ vidType );
25  $(".job-doc-type-mob-vid").append( mobileVideoUrl +'/job-usp.mp4" '+ vidType );
26  $(".wr-doc-type-mob-vid").append( mobileVideoUrl +'/writers-usp.mp4" '+ vidType );
27} else {
28  console.log("run desktop");
29  $(".ac-doc-type-desk-vid").append(desktopVideoUrl+'/academic-usp.mp4" '+ vidType);
30  $(".bus-doc-type-desk-vid").append(desktopVideoUrl+'/business-usp.mp4" '+ vidType);
31  $(".job-doc-type-desk-vid").append(desktopVideoUrl+'/job-usp.mp4" '+ vidType);
32  $(".wr-doc-type-desk-vid").append(desktopVideoUrl+'/writers-usp.mp4" '+ vidType);
33}
34
35$(".readmorebtn").click(function(){
36  $(".showmorelink, .lessbtn").removeClass("d-none");
37  $(".readmorebtn").addClass("d-none");
38});
39
40$(".lessbtn").click(function(){
41  $(".showmorelink, .lessbtn").addClass("d-none");
42  $(".readmorebtn").removeClass("d-none");
43});
44
45$(".pt-home-serv-card").mouseleave(function(){
46  $(".showmorelink, .lessbtn").addClass("d-none");
47  $(".readmorebtn").removeClass("d-none");
48});
49/* show and hide short service list in mobile */
50$('#accordionServices .collapse').on('shown.bs.collapse', function () {
51  $(this).siblings().children(".showlessmoblink").hide();
52  $(this).siblings().children(".showlessmoblink").fadeOut(0, function() {
53    $(this).hide();
54  });
55});
56$('#accordionServices .collapse').on('hidden.bs.collapse', function () {
57  $(this).siblings().children(".showlessmoblink").show();
58  $(this).siblings().children(".showlessmoblink").fadeIn(0, function() {
59    $(this).show();
60  });
61});
62
63// email validation 
64function IsEmail(emailVal) {
65  var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
66    return regex.test(emailVal);
67}
68
69var docVideoDesk = document.getElementById("videoDocPg");
70var docVideoMob = document.getElementById("videoDocPgMob");
71if(docVideoDesk){
72  setTimeout(function(){
73    document.getElementById('videoDocPg').play();
74  }, 750)
75}
76
77if(docVideoMob){
78  setTimeout(function(){
79    document.getElementById('videoDocPgMob').play();
80  }, 750)
81}
82
83var video = document.getElementById("testimonialsVideo");
84if (video) {
85  $(video).on({
86    mouseenter: function () {
87      video.setAttribute("controls", "controls");
88    },
89    mouseleave: function () {
90      video.removeAttribute("controls");
91    },
92    click: function (e) {
93      e.preventDefault();
94      e.stopPropagation();
95
96      if (!video.paused) {
97        video.pause();
98        return;
99      }
100
101      // Do NOT call load()
102      video.play().catch(function (error) {
103        console.log("Video play failed:", error);
104      });
105    }
106  });
107}
108
109/* START - CROSS BROWSER - FIXES */
110// for all VIDEOS in the 1st SECTION of the pages,:-
111// it disables the download,take picture and right click context, which also contains download option.
112if ('pictureInPictureEnabled' in document) {
113  $('#videoDocPg,.video-shadow.vid-desk-ser-pg').on("loadeddata", function() {
114    $('#videoDocPg,.video-shadow.vid-desk-ser-pg').attr('controlsList', 'nodownload');
115    $('#videoDocPg,.video-shadow.vid-desk-ser-pg').bind('contextmenu',function() { return false; });
116    $('#videoDocPg,.video-shadow.vid-desk-ser-pg').attr('disablePictureInPicture', 'true');
117  });
118}
119/* END - CROSS BROWSER - FIXES */
120
121$(window).scroll(function() {
122  $(video).each(function(){
123    if (!$(this).is(":in-viewport")) {
124      $(this)[0].pause();
125        
126    }
127  })
128  var done = 0;
129  $("#howItWorksScroll").each(function(){
130    if ($(this).is(":in-viewport")) {
131      how_scroll(0);
132  
133    }
134  })
135});
136
137
138$(function(){
139  $("#carouselSamSection").carousel();
140  $("#carouselSamSection").on('slide.bs.carousel',function(e){
141    $('#carouselSamSection .carousel-control-prev, #carouselSamSection .carousel-control-next').addClass('d-none');
142  })
143  $("#carouselSamSection").on('slid.bs.carousel',function(e){
144    $('#carouselSamSection .carousel-control-prev, #carouselSamSection .carousel-control-next').removeClass('d-none');
145
146    // Check for the third item active
147    if ($('#story-page-carousel #carouselSamSection .carousel-item:nth-child(3)').hasClass('active')) {
148      $('#carouselSamSection .carousel-control-prev').css('top', '24px');
149      $('#carouselSamSection .carousel-control-next').css('top', '24px');
150    } else {
151      $('#carouselSamSection .carousel-control-prev').css('top', '');
152      $('#carouselSamSection .carousel-control-next').css('top', '');
153    }
154  })
155});
156
157
158$('#carouselSamSection').hover(function () { 
159  $(this).carousel('pause') 
160}, function () { 
161  $(this).carousel('cycle') 
162});
163
164
165
166// free sample show popup
167
168var checkIsFreeSampleOrdered = sessionStorage.getItem('isFreeSampleOrdered')
169var isFreeSampleWarning = sessionStorage.getItem('freeSampleWarning')
170var freeSamplePathname = window.location.pathname.split("/").pop();
171
172
173// check free sample ordered
174if(checkIsFreeSampleOrdered && (freeSamplePathname === 'free-sample-edit' || freeSamplePathname === 'sample')){
175    sessionStorage.setItem('freeSampleWarning', JSON.stringify('true'));
176    window.location.href = "/";
177}
178
179$( document ).ready(function() {
180    // checke free sample ordered and hide free sample button
181    if (checkIsFreeSampleOrdered) {
182        $(".is-free-sample").addClass("d-none");
183    }
184    // checke free sample ordered and show free sample warning popup
185    if(isFreeSampleWarning){
186        $("#freeSampleWarning").modal("show");
187    }
188});
189
190function closePopUpFreeWarning(){
191    $("#freeSampleWarning").modal("hide");
192    window.location.href = "/ordering/editing-proofreading-services";
193    sessionStorage.removeItem('freeSampleWarning');
194}
195
196function routeToOrdering(){
197    closePopUpFreeWarning();
198    window.location.href = "/ordering/editing-proofreading-services";
199}
200
201$(document).ready(function(){
202  // Find the Service section div on click
203  $("#viewServices").click(function() {
204    $('html, body').animate({
205        scrollTop: $("#serSectionPosition").offset().top
206    }, 500);
207  });
208
209  function OpenPopupCenter(pageURL, title, w, h) {
210    var left = (screen.width - w) / 2;
211    var top = (screen.height - h) / 4;
212    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
213  }
214
215  //our editor section
216  // let name = '<%-name%>';
217  const tooltipTemplateSer = `
218  <div class="tooltip" role="button">
219      <div class="tooltip-arrow arrow my-tooltip-arrow"></div>
220      <div class="tooltip-inner my-tooltip-inner servicestooltip"></div>
221  </div>`;
222
223  $('#editingServicesEssTooltip, #editingServicesStaTooltip, #editingServicesPreTooltip').tooltip({
224      template: tooltipTemplateSer,  
225  }); 
226
227  const tooltipTemplate4 = `
228  <div class="tooltip edit-job-review-page" role="button">
229      <div class="tooltip-arrow arrow my-tooltip-arrow"></div>
230      <div class="tooltip-inner my-tooltip-inner large"></div>
231  </div>`;
232  $('.editjob').tooltip({
233    trigger: 'hover focus',
234    template: tooltipTemplate4,
235    html: true,
236    container: 'body',            
237  });  
238  const tooltipTemplate = `
239         <div class="tooltip cust-tooltip-main" role="button" >
240             <div class="tooltip-arrow arrow my-tooltip-arrow"></div>
241             <div class="tooltip-inner my-tooltip-inner"></div>
242         </div>`;
243  $('[data-toggle="tooltip"]').each(function () {
244    $('[data-toggle="tooltip"]').tooltip({
245        trigger: 'hover focus',
246        template: tooltipTemplate,
247        html: true,
248        container: 'body',            
249    });        
250  });     
251
252  
253  
254  
255  setTimeout(function(){ $('[data-toggle="tooltip"]').tooltip('hide'); }, 3000);    
256
257  $("[id*='viewSample'][id$='Modal'],.modal:not([data-backdrop='static'])").on('hidden.bs.modal', function () {
258    window.location.hash = '';
259  });
260  
261
262  if(document.getElementById("editorSubText") != null)
263  document.getElementById("editorSubText").onscroll = function( event ) {
264    console.log('You will never see this message.');
265  };
266
267
268  //window.scrollTo(0, 0);
269  if(document.getElementById('myCarouselMob') != null)
270  document.getElementById('myCarouselMob').style.display = "block";
271  $('#refined-style, #in-depth-feedback, .p2, .p3').addClass('d-none');
272  $('#myCarousel').addClass('d-block');
273  $('#error-free-language-tab').addClass('active');
274 
275  $("#error-free-language-tab").click(function(){
276    $('#error-free-language, .p1').removeClass('d-none');
277    $('#refined-style, #in-depth-feedback, .p2,.p3').addClass('d-none');
278    $('#myCarousel').addClass('d-block');
279    $('#myCarousel2,#myCarousel3').removeClass('d-block');
280    $('#error-free-language-tab').addClass('active');
281    $('#refined-style-tab, #in-depth-feedback-tab').removeClass('active');
282  });
283
284  $("#refined-style-tab").click(function(){
285    $('#refined-style, .p2').removeClass('d-none');
286    $('#error-free-language, #in-depth-feedback, .p1, .p3').addClass('d-none');
287    $('#myCarousel2').addClass('d-block');
288    $('#myCarousel, #myCarousel3').removeClass('d-block');
289    $('#refined-style-tab').addClass('active');
290    $('#error-free-language-tab, #in-depth-feedback-tab').removeClass('active');
291  });
292
293  $("#in-depth-feedback-tab").click(function(){
294    $('#refined-style, #error-free-language, .p1, .p2').addClass('d-none');
295    $('#in-depth-feedback, .p3').removeClass('d-none');
296    $('#myCarousel3').addClass('d-block');
297    $('#myCarousel2, #myCarousel').removeClass('d-block');
298    $('#in-depth-feedback-tab').addClass('active');
299    $('#refined-style-tab, #error-free-language-tab').removeClass('active');
300  });
301
302});
303
304function removeClass(){
305  $(".showTabLink").removeClass('d-flex');
306  $(".showTabLink").addClass('d-none');
307}
308
309
310
311$(document).scroll(function () {
312  var showTopMenu = $(this).scrollTop();
313  if (showTopMenu > 50) {
314    $('.topmenuscrollshow').fadeIn();
315  } else {
316    $('.topmenuscrollshow').fadeOut();
317  }
318});
319
320
321
322var done = 0;
323motionPath: " #path";
324gsap.registerPlugin(MotionPathPlugin);
325// nave Bar
326
327
328// Editor Div Show Animation
329
330var $animation_elements = $('#editorSubText');
331var $window = $(window);
332
333function check_if_in_view() {
334  var window_height = $window.height();
335  var window_top_position = $window.scrollTop();
336  var window_bottom_position = (window_top_position + window_height);
337  $.each($animation_elements, function() {
338    var $element = $(this);
339    var element_height = $element.outerHeight();
340    var element_top_position = $element.offset().top;
341    var element_bottom_position = (element_top_position + element_height);
342 
343    //check to see if this current container is within viewport
344    if ((element_bottom_position >= window_top_position) &&
345        (element_top_position <= window_bottom_position)) {
346          fadeEditorAnimation($('#editorSubText li').eq(0))
347    } 
348  });
349}
350
351$window.on('scroll resize', check_if_in_view);
352$window.trigger('scroll');
353
354function fadeEditorAnimation(ele) {
355  ele.fadeIn(800, function() { // set fade animation fothe emlement
356    var nxt = ele.next(); // get sibling next to current eleemnt
357    if (nxt.length) // if element exist
358    fadeEditorAnimation(nxt); // call the function for the next element
359  });
360}
361
362
363
364 
365
366motionPath: " #path";
367gsap.registerPlugin(MotionPathPlugin);
368var done = 0;
369
370function how_scroll(n) {
371  var elmnt = document.documentElement;
372  var x = elmnt.scrollLeft;
373  var y = elmnt.scrollTop;
374
375  if (done == 0) {
376    if (y > n) {
377      setTimeout(how_start);
378      done = 1;
379    }
380  }
381}
382
383
384 // call the function with first element
385function how_reverse() { }
386
387function how_start() {
388  gsap.to("#dot", {
389    duration: 6,
390    repeatDelay: 3,
391    yoyo: true,
392    ease: "none",
393    motionPath: {
394      path: "#path",
395      align: "#path",
396      autoRotate: true,
397      alignOrigin: [0.5, 0.5],
398    },
399  });
400  gsap.to("#path", {
401    duration: 6,
402    strokeDashoffset: 0,
403    delay: 0,
404    ease: "none",
405  });
406  gsap.to("#path", {
407    duration: 0,
408    strokeDasharray: 0,
409    delay: 6,
410    ease: "none",
411  });
412  gsap.to("#how_1", {
413    duration: 2,
414    scale: 1.1,
415    delay: 0,
416    ease: "elastic.out(0.6)",
417  });
418  gsap.to("#arrow-1-ani", {
419    duration: 3,
420    scale: 1,
421    rotate: -90,
422    delay: 6,
423    ease: "elastic.out(1, 0.5)",
424  });
425  gsap.to("#arrow-2-ani", {
426    duration: 3,
427    scale: 1,
428    rotate: -180,
429    delay: 6,
430    ease: "elastic.out(1, 0.5)",
431  });
432  gsap.to("#arrow-3-ani", {
433    duration: 3,
434    scale: 1,
435    rotate: 0,
436    delay: 6,
437    ease: "elastic.out(1, 0.5)",
438  });
439  gsap.to("#arrow-4-ani", {
440    duration: 3,
441    scale: 1,
442    rotate: -180,
443    delay: 6,
444    ease: "elastic.out(1, 0.5)",
445  });
446  gsap.to("#arrow-5-ani", {
447    duration: 3,
448    scale: 1,
449    rotate: 0,
450    delay: 6,
451    ease: "elastic.out(1, 0.5)",
452  });
453  gsap.to("#how_2", {
454    duration: 2,
455    scale: 1.1,
456    delay: 1,
457    ease: "elastic.out(0.6)",
458  });
459  gsap.to("#how_3", {
460    duration: 2,
461    scale: 1.1,
462    delay: 2.25,
463    ease: "elastic.out(0.6)",
464  });
465  gsap.to("#how_4", {
466    duration: 2,
467    scale: 1.1,
468    delay: 3.5,
469    ease: "elastic.out(0.6)",
470  });
471  gsap.to("#how_5", {
472    duration: 2,
473    scale: 1.1,
474    delay: 4.5,
475    ease: "elastic.out(0.6)",
476  });
477  gsap.to("#how_6", {
478    duration: 2,
479    scale: 1.1,
480    delay: 6,
481    ease: "elastic.out(0.6)",
482  });
483}
484
485
486function OpenPopupCenter(pageURL, title, w, h) {
487  var left = (screen.width - w) / 2;
488  var top = (screen.height - h) / 4;
489  var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' 
489+ top + ', left=' + left);
490}
491
492
493function openNav() {
494  $("#PtSidenav").css({"width":"280px"});
495  $("#PtSidenav").addClass("opened");
496  $("#openNavMenu").addClass("d-none");
497  $(".close-menu").removeClass("dnone")
498}
499
500$(".suba").click(function(){
501  var firstNavMenu = $(this).attr('attr-target');
502  $("#"+firstNavMenu).css({"width":"280px"});
503});
504
505$(".close-menu").click(function(){
506   $(".sidenav").css({"width":"0"});
507   $("#openNavMenu").removeClass("d-none");
508   $(".close-menu").addClass("dnone");
509   $("#PtSidenav").addClass("d-none");
510 })
511
512$("a").click(function(){
513  $("#subServicesMenu").toggleClass("d-none");
514});
515
516$(".back-arrow").click(function(){
517  console.log("object");
518  var closestId = $(this).closest('div').attr('id')
519  $("#"+closestId).css({"width":"0px"});
520})
521
522$('#editingSample, #bookPrintingSample, #typesettingSample, #coverDesignSample, #bookDistributionSample, #otherServicesSample, #teaserSample, #bookMrkSample, #ISBNregistration, #barcodeCreation, #copyrightPage, #blurbWriting, #bookReviewWriting, #audiobook, #publishingJourneyOther, #promotionalVideo, #promotionalPost, #pressRelease, #merchandiseDesign, #seoArticle').on('hidden.bs.modal', function () {
523  if ($('.modal.show').length) {
524    $('body').addClass('modal-open');
525  }
526});
527
528
529(function () {
530  'use strict';
531
532  var videoLoaded = false;
533
534  function initVideoLazyLoad() {
535    var testimonialsVideo = document.getElementById('testimonialsVideo');
536    var videoDiv = document.getElementById('videoDiv');
537
538    if (!testimonialsVideo || !videoDiv) return;
539
540    function loadVideo() {
541      if (videoLoaded) return;
542
543      videoLoaded = true;
544
545      // Just set preload — browser handles the request
546      // Mark that video is loading to prevent duplicate loads
547      testimonialsVideo.setAttribute('preload', 'auto');
548      testimonialsVideo.dataset.lazyLoaded = 'true';
549    }
550
551    // Use Intersection Observer to detect when videoDiv enters viewport
552    if ('IntersectionObserver' in window) {
553      var observer = new IntersectionObserver(function(entries) {
554        entries.forEach(function(entry) {
555          if (entry.isIntersecting) {
556            loadVideo();
557            // Stop observing after loading
558            observer.unobserve(videoDiv);
559          }
560        });
561      }, {
562        // Trigger when element is 100px away from viewport
563        rootMargin: '100px 0px',
564        threshold: 0
565      });
566
567      observer.observe(videoDiv);
568    } else {
569      // Fallback for browsers without Intersection Observer
570      function checkScroll() {
571        var rect = videoDiv.getBoundingClientRect();
572        var isVisible = rect.top < window.innerHeight && rect.bottom > 0;
573        
574        if (isVisible) {
575          loadVideo();
576          window.removeEventListener('scroll', checkScroll);
577        }
578      }
579      
580      // Check immediately if already visible
581      checkScroll();
582      window.addEventListener('scroll', checkScroll, { passive: true });
583    }
584  }
585
586  if (document.readyState === 'loading') {
587    document.addEventListener('DOMContentLoaded', initVideoLazyLoad);
588  } else {
589    initVideoLazyLoad();
590  }
591})();

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.