1//Handle web push notification 2var NUMBER_OF_VISITTED_KEY="NUMBER_OF_VISITTED"; 3var MOBILE_APP_DONE_INTRODUCED_KEY = "MOBILE_APP_V1_9_8_DONE_INTRODUCED_KEY"; 4 5var numberOfVisitted=0; 6var app_url = 'https://itunes.apple.com/app/paste-keyboard-copy-keyboard/id1570011952'; 7 8if(localStorage.getItem(NUMBER_OF_VISITTED_KEY)!=null){ 9 numberOfVisitted = parseInt(localStorage.getItem(NUMBER_OF_VISITTED_KEY)); 10} 11numberOfVisitted++; 12localStorage.setItem(NUMBER_OF_VISITTED_KEY, numberOfVisitted); 13var isShortWindowsHeight = false 14 15 16var isInMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 17var isIniOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; 18var isInChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); 19var ua = navigator.userAgent.toLowerCase(); 20var isInAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile"); 21var isInFirefox = ua.indexOf("firefox") > -1; 22 23if(isInMobile && isIniOS){ 24 $("#modal-footer-fk").show(); 25} 26 27if(isInMobile && !isIniOS){ 28 $("#fk_ios_link").hide(); 29} 30//Dismiss the keyboard when user press Return key 31$('input').keyup(function(event) { 32 if (event.which === 13) { 33 $(this).blur(); 34 } 35}); 36 37$('#list-font-preview-container input:text').click(function () { 38 document.execCommand('selectAll', false, null); 39}); 40 41imageUrlPath = 'images/copy_paste_keyboard.png'; 42 43// if(isInAndroid){ 44// app_url = 'https://play.google.com/store/apps/details?id=com.highstarapp.pastekeyboard'; 45// } 46// else if(isIniOS){ 47// app_url = 'https://itunes.apple.com/app/paste-keyboard-copy-keyboard/id1570011952'; 48// } 49 50// if(isInMobile){ 51// introduceFKApp(); 52// if(numberOfVisitted%10==0){ 53// if(isIniOS){ 54// Swal.fire({ 55// title: 'Thank you for using our tool. Please also try our Paste Keyboard app to quickly type on your phone!', 56// showCancelButton: true, 57// allowOutsideClick: false, 58// confirmButtonText: 'Yes, install it now', 59// cancelButtonText: "Already installed", 60// imageUrl: imageUrlPath, 61 62// }).then((result) => { 63// if (result.value) { 64// var app_url = 'https://itunes.apple.com/app/copy-paste-keyboard/id1570011952'; 65// $(location).attr('href', app_url); 66// } else if (result.dismiss === Swal.DismissReason.cancel) { 67 68// } 69// }) 70// } 71// else if(isInAndroid){ 72// Swal.fire({ 73// title: 'Thank you for using our tool. Please also try our Paste Keyboard app to quickly type on your phone!!', 74// showCancelButton: true, 75// allowOutsideClick: false, 76// confirmButtonText: 'Yes, try it now', 77// cancelButtonText: "Already installed", 78// imageUrl: imageUrlPath, 79 80// }).then((result) => { 81// if (result.value) { 82// var app_url = 'https://play.google.com/store/apps/details?id=com.highstarapp.pastekeyboard'; 83// $(location).attr('href', app_url); 84// } else if (result.dismiss === Swal.DismissReason.cancel) { 85 86// } 87// }) 88// } 89// } 90// } 91 92// function introduceFKApp(){ 93// if(localStorage.getItem(MOBILE_APP_DONE_INTRODUCED_KEY)==null && numberOfVisitted>=5){ 94// Swal.fire({ 95// title: 'We will let you use this website for free with all fonts, symbols, emoji,... Please just install our free Paste Keyboard app first, and then you can use this web app freely without any charge!', 96// showCancelButton: true, 97// allowOutsideClick: false, 98// confirmButtonText: 'Yes, install it now', 99// cancelButtonText: "Later", 100// imageUrl: imageUrlPath, 101 102// }).then((result) => { 103// if (result.value) { 104// localStorage.setItem(MOBILE_APP_DONE_INTRODUCED_KEY, 1); 105// var app_url = 'https://itunes.apple.com/app/copy-paste-keyboard/id1570011952'; 106// if(isInAndroid){ 107// app_url = 'https://play.google.com/store/apps/details?id=com.highstarapp.pastekeyboard'; 108// } 109// $(location).attr('href', app_url); 110// } else if (result.dismiss === Swal.DismissReason.cancel) { 111 112// } 113// }) 114// } 115// } 116function getParameterByName(name, url) { 117 if (!url) url = window.location.href; 118 name = name.replace(/[\[\]]/g, "\\$&"); 119 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 120 results = regex.exec(url); 121 if (!results) return null; 122 if (!results[2]) return ''; 123 return decodeURIComponent(results[2].replace(/\+/g, " ")); 124} 125 126function getWholeChar(str, i) { 127 var code = str.charCodeAt(i); 128 129 if (Number.isNaN(code)) { 130 return ''; // Position not found 131 } 132 if (code < 0xD800 || code > 0xDFFF) { 133 return str.charAt(i); 134 } 135 136 // High surrogate (could change last hex to 0xDB7F to treat high private 137 // surrogates as single characters) 138 if (0xD800 <= code && code <= 0xDBFF) { 139 if (str.length <= (i + 1)) { 140 throw 'High surrogate without following low surrogate'; 141 } 142 var next = str.charCodeAt(i + 1); 143 if (0xDC00 > next || next > 0xDFFF) { 144 throw 'High surrogate without following low surrogate'; 145 } 146 return str.charAt(i) + str.charAt(i + 1); 147 } 148 // Low surrogate (0xDC00 <= code && code <= 0xDFFF) 149 if (i === 0) { 150 throw 'Low surrogate without preceding high surrogate'; 151 } 152 var prev = str.charCodeAt(i - 1); 153 154 // (could change last hex to 0xDB7F to treat high private 155 // surrogates as single characters) 156 if (0xD800 > prev || prev > 0xDBFF) { 157 throw 'Low surrogate without preceding high surrogate'; 158 } 159 // We can pass over low surrogates now as the second component 160 // in a pair which we have already processed 161 return false;
162} 163 164function unicodeLength(str) { 165 return [...str].length; 166} 167 168$("#modal-footer-close").on( "click", function() { 169 $("#myModal").css("display", "none"); 170}); 171 172function showCopyingModalDialog(theText){ 173 var firstChar = getWholeChar(theText,0); 174 var firstCharLength=firstChar.length; 175 if(firstCharLength==1){ 176 var secondChar = getWholeChar(theText,1); 177 if(secondChar.length>firstCharLength) 178 firstCharLength=secondChar.length; 179 } 180 181 182 if($(window).height() < 700){ 183 isShortWindowsHeight = true; 184 } 185 var cutOffWordLengthInMobile = 55; 186 if(isShortWindowsHeight){ 187 cutOffWordLengthInMobile = 33 188 } 189 if(isInMobile){ 190 if(unicodeLength(theText)>cutOffWordLengthInMobile){ 191 var lastCharIndex=(cutOffWordLengthInMobile-3)*firstCharLength; 192 if(getWholeChar(theText,lastCharIndex)==false) 193 lastCharIndex--; 194 theText=theText.substring(0,lastCharIndex)+"..."; 195 } 196 } 197 else{ 198 if(unicodeLength(theText)>75){ 199 var lastCharIndex=72*firstCharLength; 200 if(getWholeChar(theText,lastCharIndex)==false) 201 lastCharIndex--; 202 theText=theText.substring(0,lastCharIndex)+"..."; 203 } 204 } 205 206 $("#myModal").css("display", "block"); 207 $("#myModal").css("position", "fixed"); 208 $("#myModal").css("visibility", "visible"); 209 210 var theHTML = "<div><span class='the_copied_text'>"+theText + "</span></div><div><span class='the_copied_text_description'> has been <span class='emphasis'>copied</span>. Please paste anywhere! "; 211 212 // $("#modal-footer-close").insertBefore("#modal-body"); 213 214 // if(!isInMobile && isInChrome){ 215 // theHTML = "<div><span class='the_copied_text'>"+theText + "</span></div><div><span class='the_copied_text_description'> was <span class='emphasis'>copied</span>. Please also use our <a class='extension_intro' target='_blank' href='https://chrome.google.com/webstore/detail/youtube-adblock/fljhkpbnflocmlnibjdfppinagckppaj'>Youtube Adblock extension</a> to remove any ads on Youtube & <a class='extension_intro' target='_blank' href='https://chrome.google.com/webstore/detail/emoji-keyboard-suite/bgfnnlpfffokmclmlogmcmfagcimbhee'>Emoji Keyboard extension</a> to get emoji!"; 216 // } 217 218 if(isInMobile){ 219 if(isIniOS){ 220 theHTML += "<span class='ask_to_try_FK'>And please also try the <a href='https://itunes.apple.com/app/id1272051344'>app version</a></a> of this tool for free!</span></span></div>"; 221 } 222 else{ 223 theHTML += "<span class='ask_to_try_FK'>And please also try the <a href='https://play.google.com/store/apps/details?id=com.highstarapp.fontkeyboard'>app version</a> of this tool for free!</span></span></div>"; 224 } 225 } 226 227 228 $("#modal_header").html(theHTML); 229}
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.