Changeset View
Changeset View
Standalone View
Standalone View
src/lib/data/html/speeddial.user.js
1 | // ==UserScript== | 1 | // ==UserScript== | ||
---|---|---|---|---|---|
2 | // @name _falkon_speeddial | 2 | // @name _falkon_speeddial | ||
3 | // @run-at document-end | 3 | // @run-at document-end | ||
4 | // @include falkon:speeddial | 4 | // @include falkon:speeddial | ||
5 | // ==/UserScript== | 5 | // ==/UserScript== | ||
6 | 6 | | |||
7 | var scriptData = {}; | 7 | var scriptData = {}; | ||
8 | var editingId = -1; | 8 | var editingId = -1; | ||
9 | var ignoreNextChanged = false; | 9 | var ignoreNextChanged = false; | ||
10 | 10 | | |||
11 | function b64DecodeUnicode(str) { | ||||
12 | return decodeURIComponent(atob(str).split('').map(function(c) { | ||||
13 | return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); | ||||
14 | }).join('')); | ||||
15 | } | ||||
16 | | ||||
11 | function emitChanged(pages) | 17 | function emitChanged(pages) | ||
12 | { | 18 | { | ||
13 | ignoreNextChanged = true; | 19 | ignoreNextChanged = true; | ||
14 | external.speedDial.changed(pages); | 20 | external.speedDial.changed(pages); | ||
15 | } | 21 | } | ||
16 | 22 | | |||
17 | function addSpeedDial() | 23 | function addSpeedDial() | ||
18 | { | 24 | { | ||
Show All 22 Lines | 43 | if ($('#BgImgToggle').prop('checked') != true) { | |||
41 | } | 47 | } | ||
42 | if ($('#SdSizeToggle').prop('checked') != true) | 48 | if ($('#SdSizeToggle').prop('checked') != true) | ||
43 | $('#SdSizeStateColor').css('color', 'rgba(0,0,0, 0.0)'); | 49 | $('#SdSizeStateColor').css('color', 'rgba(0,0,0, 0.0)'); | ||
44 | // ======================== SHOW DIALOG ======================== // | 50 | // ======================== SHOW DIALOG ======================== // | ||
45 | $('#fadeOverlay2').css({'filter' : 'alpha(opacity=100)'}).fadeIn(); | 51 | $('#fadeOverlay2').css({'filter' : 'alpha(opacity=100)'}).fadeIn(); | ||
46 | $('#fadeOverlay2').click(function() { $(this).fadeOut('slow'); }); | 52 | $('#fadeOverlay2').click(function() { $(this).fadeOut('slow'); }); | ||
47 | $('#settingsBox').click(function(event) { event.stopPropagation(); }); | 53 | $('#settingsBox').click(function(event) { event.stopPropagation(); }); | ||
48 | } | 54 | } | ||
55 | | ||||
49 | function escapeTitle(title) { | 56 | function escapeTitle(title) { | ||
50 | title = title.replace(/"/g, '"'); | 57 | title = title.replace(/"/g, '"'); | ||
51 | title = title.replace(/'/g, '''); | 58 | title = title.replace(/'/g, '''); | ||
52 | return title; | 59 | return title; | ||
53 | } | 60 | } | ||
54 | 61 | | |||
55 | function unescapeTitle(title) { | 62 | function unescapeTitle(title) { | ||
56 | title = title.replace(/"/g, '"'); | 63 | title = title.replace(/"/g, '"'); | ||
▲ Show 20 Lines • Show All 386 Lines • ▼ Show 20 Line(s) | 449 | $(document).keyup(function(e) { | |||
443 | if (editingId == -1) | 450 | if (editingId == -1) | ||
444 | return; | 451 | return; | ||
445 | if (e.keyCode == 13) | 452 | if (e.keyCode == 13) | ||
446 | boxEdited(); | 453 | boxEdited(); | ||
447 | else if (e.keyCode == 27) | 454 | else if (e.keyCode == 27) | ||
448 | $('#fadeOverlay').click(); | 455 | $('#fadeOverlay').click(); | ||
449 | }); | 456 | }); | ||
450 | 457 | | |||
451 | var pages = JSON.parse(atob(scriptData.initialScript)); | 458 | var pages = JSON.parse(b64DecodeUnicode(scriptData.initialScript)); | ||
452 | for (var i = 0; i < pages.length; ++i) { | 459 | for (var i = 0; i < pages.length; ++i) { | ||
453 | var page = pages[i]; | 460 | var page = pages[i]; | ||
454 | addBox(page.url, page.title, page.img); | 461 | addBox(page.url, page.title, page.img); | ||
455 | } | 462 | } | ||
456 | 463 | | |||
457 | external.speedDial.pagesChanged.connect(function() { | 464 | external.speedDial.pagesChanged.connect(function() { | ||
458 | if (ignoreNextChanged) { | 465 | if (ignoreNextChanged) { | ||
459 | ignoreNextChanged = false; | 466 | ignoreNextChanged = false; | ||
Show All 39 Lines |