1!function (e) { "function" == typeof define && define.amd ? define(["jquery"], e) : e(jQuery) }(function (m) { var i = /\+/g; function v(e) { return l.raw ? e : encodeURIComponent(e) } function x(e, n) { var o = l.raw ? e : function (e) { 0 === e.indexOf('"') && (e = e.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\")); try { e = decodeURIComponent(e.replace(i, " ")) } catch (e) { return } try { return l.json ? JSON.parse(e) : e } catch (e) { } }(e); return m.isFunction(n) ? n(o) : o } var l = m.cookie = function (e, n, o) { if (void 0 !== n && !m.isFunction(n)) { if ("number" == typeof (o = m.extend({}, l.defaults, o)).expires) { var i = o.expires, t = o.expires = new Date; t.setDate(t.getDate() + i) } return document.cookie = [v(e), "=", function (e) { return v(l.json ? JSON.stringify(e) : String(e)) }(n), o.expires ? "; expires=" + o.expires.toUTCString() : "", o.path ? "; path=" + o.path : "", o.domain ? "; domain=" + o.domain : "", o.secure ? "; secure" : ""].join("") } for (var r, c = e ? void 0 : {}, u = document.cookie ? document.cookie.split("; ") : [], a = 0, d = u.length; a < d; a++) { var f = u[a].split("="), s = (r = f.shift(), l.raw ? r : decodeURIComponent(r)), p = f.join("="); if (e && e === s) { c = x(p, n); break } e || void 0 === (p = x(p)) || (c[s] = p) } return c }; l.defaults = {}, m.removeCookie = function (e, n) { return void 0 !== m.cookie(e) && (m.cookie(e, "", m.extend({}, n, { expires: -1 })), !0) } }); 2 3$(function () { 4 5 $('img.svg').each(function () { 6 var $img = $(this); 7 var imgID = $img.attr('id'); 8 var imgClass = $img.attr('class'); 9 var imgURL = $img.attr('src'); 10 11 $.get(imgURL, function (data) { 12 // Get the SVG tag, ignore the rest 13 var $svg = $(data).find('svg'); 14 15 // Add replaced image's ID to the new SVG 16 if (typeof imgID !== 'undefined') { 17 $svg = $svg.attr('id', imgID); 18 } 19 // Add replaced image's classes to the new SVG 20 if (typeof imgClass !== 'undefined') { 21 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 22 } 23 24 // Remove any invalid XML tags as per http://validator.w3.org 25 $svg = $svg.removeAttr('xmlns:a'); 26 27 // Replace image with new SVG 28 $img.replaceWith($svg); 29 }, 'xml'); 30 }); 31 32}); 33 34 35$(function () { 36 if (!window.collectionSystem) { 37 window.collectionSystem = new Map([]); 38 } 39 var Utils = { 40 setCookie: function (name, value, days) { 41 var expires = ""; 42 if (days) { 43 var date = new Date(); 44 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 45 expires = "; expires=" + date.toUTCString(); 46 } 47 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 48 }, 49 getCookie: function (name) { 50 var nameEQ = name + "=", 51 ca = document.cookie.split(';'); 52 for (var i = 0; i < ca.length; i++) { 53 var c = ca[i]; 54 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 55 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 56 } 57 return null; 58 }, 59 eraseCookie: function (name) { 60 document.cookie = name + '=; Max-Age=-99999999;'; 61 } 62 }; 63 64 65 class Notify { 66 constructor() { 67 } 68 69 install() { 70 let data = { 71 title: window.CC_TRANSLATE.NO_INSTALL.title, 72 message: window.CC_TRANSLATE.NO_INSTALL.message 73 } 74 75 76 //window.location.href = "#callaction"; 77 78 79 80 new duDialog(data.title, data.message, duDialog.OK_CANCEL, { 81 okText: 'Install', 82 callbacks: { 83 okClick: function () { 84 this.hide(); 85 window.location.href = GExtensionId; 86 } 87 } 88 }); 89 } 90 91 update() { 92 let data = { 93 title: "Please update Chrome Extension - Cool Cursors!!!", 94 message: "Please update Chrome Extension - Cool Cursors!!!" 95 } 96 new duDialog(data.title, data.message, duDialog.OK_CANCEL, { 97 okText: 'Okey', 98 callbacks: {
99 okClick: function () { 100 this.hide(); // hides the dialog 101 } 102 } 103 }); 104 } 105 106 successInstallCollection(data) { 107 $.growl.notice({ 108 title: "Success", 109 message: `Collection ${data.name} installed` 110 }); 111 } 112 113 successInstallPack(data) { 114 $.growl.notice({ 115 title: "Success", 116 message: `Cursor Pack ${data.name} installed` 117 }); 118 } 119 120 successSaveOnGdrive(data) { 121 var items = ""; 122 for (var i in data) { 123 items += data[i].name + "<br/>"; 124 } 125 $.growl.notice({ 126 title: "Success", 127 message: `${items} saved on your Gdrive` 128 }); 129 } 130 } 131 132 class Core { 133 constructor() { 134 this.extensionId = GExtensionIdAlone; 135 this.isInstalled = false; 136 this.collections = []; 137 this.collectionsInstalled = {}; 138 this.installedPacks = new Map(); 139 this.collectionIds = {}; 140 this.version = 1; 141 this.mode = 'dev'; 142 this.map = new Map(); 143 this.driveManager = new DriveManager(); 144 this.driveManager.initDrive().then(async () => { 145 await this.onDriveReady(); 146 }); 147 148 } 149 150 init() { 151 try { 152 chrome.runtime.sendMessage(this.extensionId, { action: 'getInstalled' }, this.responseInstalled.bind(this)) 153 } catch (e) { 154 console.log(JSON.stringify(e)); 155 } 156 157 } 158 159 setDriveFile(driveFile) { 160 let totalSize = 0; 161 driveFile.forEach(f => totalSize += Number(f.sizeBytes || f.size)); 162 163 selectingInput = { 164 drive: driveFile, 165 count: driveFile.length, 166 size: totalSize, 167 }; 168 169 } 170 171 async onDriveReady() { 172 173 174 let data = await this.driveManager.checkInitialDriveState(); 175 if (data) { 176 let openingFileId = data.state.ids[0]; 177 let fileInfo = await this.driveManager.getFileInfo(openingFileId, "id,mimeType,name,size"); 178 179 setDriveFile(fileInfo); 180 } 181 } 182 183 184 responseInstalled(response) { 185 186 if (!response) { 187 $("#callaction").show(); 188 $(".inline-install").show(); 189 $(".top-feattxt .arrow-btn").show(); 190 191 this.isInstalled = false;
192 Utils.setCookie("isInstalled", 0, 360); 193 return false; 194 } else { 195 Utils.setCookie("isInstalled", 1, 360); 196 } 197 198 if (response.collections) { 199 $("#callaction").hide(); 200 $(".inline-install").hide(); 201 $(".top-feattxt .arrow-btn").hide(); 202 203 Utils.setCookie('uid', response.uid, 360); 204 Utils.setCookie('ver', response.ver, 360); 205 Utils.setCookie("isInstalled", 1, 360); 206 207 this.isInstalled = true; 208 this.collectionsInstalled = response.collections; 209 this.version = 2; 210 for (let i in this.collectionsInstalled) { 211 this.collectionIds[this.collectionsInstalled[i].id] = []; 212 213 let tmp = []; 214 for (let y in this.collectionsInstalled[i].items) { 215 this.collectionIds[this.collectionsInstalled[i].id].push(this.collectionsInstalled[i].items[y].id); 216 tmp.push(this.collectionsInstalled[i].items[y].id); 217 218 this.installedPacks.set(this.collectionsInstalled[i].items[y].id, true); 219 } 220 this.map.set(this.collectionsInstalled[i].id, tmp); 221 } 222 this.disableButtons() 223 } else {
224 Utils.setCookie("isInstalled", 1, 360); 225 this.isInstalled = true; 226 } 227 } 228 229 /** 230 * @param element 231 * @param className 232 */ 233 disableButton(element, className) { 234 if (element) { 235 element.removeClass(className); 236 element.text("Added"); 237 element.addClass('installed disabled'); 238 //element.removeClass('btn-info'); 239 element.attr('disabled', 'disabled') 240 } 241 } 242 243 244 disableBtnPack() { 245 for (let i in this.installedPacks) { 246 //console.log(i) 247 } 248 } 249 250 disableButtonAll() { 251 this.disableBtnPack() 252 for (let cId in this.collectionIds) { 253 if (window.collectionSystem) { 254 try { 255 let c = window.collectionSystem.get(parseInt(cId)); 256 if (typeof c != "undefined") { 257 let intersection = c.filter(x => !this.collectionIds[cId].includes(x)); 258 if (intersection.length == 0) { 259 let element = $(`.add-to-collection[data-collection-id='${cId}']`); 260 this.disableButton(element, 'add-to-collection'); 261 } 262 } 263 } catch (e) { 264 265 } 266 267 } 268 269 } 270 } 271 272 disableButtons() { 273 if (window.collectionSystem) { 274 for (let cId in this.collectionIds) { 275 try { 276 let c = window.collectionSystem.get(parseInt(cId)); 277 278 279 if (typeof c != "undefined") { 280 let intersection = c.filter(x => !this.collectionIds[cId].includes(x)); 281 if (intersection.length == 0) { 282 let element = $(`.add-to-collection[data-collection-id='${cId}']`); 283 this.disableButton(element, 'add-to-collection'); 284 } 285 } 286 } catch (e) { 287 console.log(e); 288 } 289 290 } 291 } 292 293 294 /** 295 * dis btn add-pack 296 */ 297 for (let collectionId in this.collectionIds) { 298 for (let packId in this.collectionIds[collectionId]) { 299 let cId = collectionId, 300 pId = this.collectionIds[collectionId][packId]; 301 302 let element = $(`.add-pack[data-pack-id='${pId}'][data-collection-id='${cId}']`); 303 this.disableButton(element, 'add-pack'); 304 } 305 } 306 } 307 308 sendMessage(data, cb) { 309 try { 310 chrome.runtime.sendMessage(this.extensionId, { 311 action: 'install_collection', 312 name: data.slug, 313 slug: data.slug, 314 collection: data 315 }, cb.bind(this)); 316 317 if (chrome.runtime.lastError) { 318 console.warn("Whoops.. " + chrome.runtime.lastError.message); 319 } else { 320 321 } 322 } catch (e) { 323 324 } 325 326 } 327 328 329 requestApiGetCollection(data) { 330 331 $.ajax({
332 url: "/api/collection", 333 method: "post", 334 data: { 335 collection: data.collection, 336 version: 2, 337 items: $.extend({}, data.items) 338 } 339 }).done(function (response) { 340 341 (new Notify()).successInstallPack(response); 342 343 this.sendMessage(response, function (response) { 344 let element = $(`.add-pack[data-pack-id='${data.pack}'][data-collection-id='${data.collection}']`); 345 346 this.installedPacks.set(data.pack, true); 347 348 this.disableButton(element, 'add-pack') 349 this.disableButtonAll() 350 }.bind(this)); 351 }.bind(this)) 352 } 353 354 async requestApiSaveCollection(data) { 355 let token = await this.driveManager.loginDrive(true); 356 if (token) { 357 $.ajax({ 358 url: "/api/gdrive", 359 method: "post", 360 data: { 361 collection: data.collection, 362 token:token, 363 items: $.extend({}, data.items) 364 } 365 }).done(function (response) { 366 367 (new Notify()).successSaveOnGdrive(response); 368 369 }.bind(this)) 370 } 371 } 372 373 } 374 375 try { 376 377 var App = new Core(); 378 App.init(); 379 380 $(".add-to-collection").not('.installed').on('click', function (e) { 381 382 var element = $(this); 383 if (element.hasClass('installed')) { 384 e.preventDefault(); 385 return; 386 } 387 var collectionId = element.data('collection-id'); 388 389 if (App.isInstalled == false) { 390 (new Notify()).install(); 391 return false; 392 } 393 394 var loaded = $.cookie('loaded'); 395 if (loaded == undefined) { 396 $.cookie('loaded', 1, { expires: 30, path: '/' }); 397 } else { 398 $.cookie('loaded', parseInt(loaded) + 1, { expires: 30, path: '/' }); 399 } 400 401 402 $.ajax({
403 url: "/api/collection", 404 method: "post", 405 data: { 406 collection: collectionId, 407 items: [], 408 version: App.version 409 } 410 }).done(function (data) { 411 debugger; 412 (new Notify()).successInstallCollection(data); 413 App.sendMessage(data, function (response) { 414 debugger; 415 this.disableButton($(`.add-to-collection[data-collection-id='${collectionId}']`), 'add-to-collection') 416 this.disableButton($(`[data-collection-id='${collectionId}']`), 'add-to-collection') 417 }) 418 419 }); 420 e.preventDefault(); 421 return false; 422 }); 423 424 425 } catch (e) { 426 console.log(e) 427 } 428 429 430 $(".card-img-top, .img-fluid").each(function () { 431 $(this).on("error", function () { 432 $(this).attr('src', '/content/img/nosign.png'); 433 }); 434 }); 435 436 437 var eventAddPack = function (e) { 438 439 var data = { 440 collection: $(this).data('collection-id'), 441 items: [$(this).data('pack-id')], 442 version: 2, 443 pack: $(this).data('pack-id') 444 }; 445 446 447 if (App.isInstalled == false) { 448 (new Notify()).install(); 449 e.preventDefault(); 450 return false; 451 } 452 if ($(this).hasClass('installed')) { 453 454 e.preventDefault(); 455 return; 456 } 457 458 459 var loaded = $.cookie('loaded'); 460 if (loaded == undefined) { 461 $.cookie('loaded', 1, { expires: 30, path: '/' }); 462 } else { 463 $.cookie('loaded', parseInt(loaded) + 1, { expires: 30, path: '/' }); 464 } 465 466 467 if (!App.collectionIds[data.collection]) { 468 App.collectionIds[data.collection] = []; 469 } 470 App.collectionIds[data.collection].push($(this).data('pack-id')); 471 data.items = App.collectionIds[data.collection]; 472 App.requestApiGetCollection(data); 473 474 475 e.preventDefault(); 476 }; 477 478 $('.add-pack').on('click', eventAddPack); 479 480 var eventGdrivePack = async function (e) { 481 482 var data = { 483 collection: $(this).data('col-id'), 484 items: [$(this).data('p-id')], 485 version: 2, 486 pack: $(this).data('p-id') 487 }; 488 489 490 if (App.isInstalled == false) { 491 (new Notify()).install(); 492 e.preventDefault(); 493 return false; 494 } 495 496 await App.requestApiSaveCollection(data); 497 498 e.preventDefault(); 499 }; 500 $('.gdrive-pack').on('click', eventGdrivePack); 501 502 503 $(document).on('click', '[data-toggle="lightbox"]', function (event) { 504 event.preventDefault(); 505 $(this).ekkoLightbox({ 506 showArrows: true, 507 alwaysShowClose: false, 508 }); 509 }); 510 $(document).on('click', '[data-toggle="modal"]', function (event) { 511 event.preventDefault(); 512 $(this).modal(); 513 }); 514 515 $('.scrollup').click(function () { 516 $("html, body").animate({ scrollTop: 0 }, 1000); 517 return false; 518 }); 519 520 $(".social-track").on("click", function (e) { 521 522 523 e.preventDefault(); 524 }); 525 526 527 $("#banner520").on("click", function (e) { 528 window.location.href = "/collections"; 529 e.preventDefault(); 530 }) 531 532 533 $("img.lazyload").lazyload(); 534 535 536}) 537
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.