61 |
62 |
63 |
--------------------------------------------------------------------------------
/WebContent/options.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Gildas Lormeau
3 | * contact : gildas.lormeau gmail.com
4 | *
5 | * This file is part of BugMeNot Lite.
6 | *
7 | * BugMeNot Lite is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * BugMeNot Lite is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with BugMeNot Lite. If not, see .
19 | */
20 |
21 | var autoHideDelayInput, neverAskFeedbackBlock, alwaysAutoSubmitInput, autoFeedbackDelayInput, maxSizeInput, minRatingInput, dontStoreVoteInput, neverVoteTwiceInput, deleteDatabaseInput;
22 |
23 | function changeAutoFeedbackDelay(fast) {
24 | if (autoFeedbackDelayInput.value >= -1) {
25 | neverAskFeedbackBlock.style.pixelHeight = 140;
26 | neverAskFeedbackBlock.style.opacity = 1;
27 | if (!fast)
28 | neverAskFeedbackBlock.className = "open";
29 | } else {
30 | neverAskFeedbackBlock.style.pixelHeight = 0;
31 | neverAskFeedbackBlock.style.opacity = 0;
32 | if (!fast)
33 | neverAskFeedbackBlock.className = "close";
34 | }
35 | };
36 |
37 | neverAskFeedbackBlock = document.getElementById("neverAskFeedbackBlock");
38 | autoHideDelayInput = document.getElementById("autoHideDelayInput");
39 | alwaysAutoSubmitInput = document.getElementById("alwaysAutoSubmitInput");
40 | autoFeedbackDelayInput = document.getElementById("autoFeedbackDelayInput");
41 | maxSizeInput = document.getElementById("maxSizeInput");
42 | minRatingInput = document.getElementById("minRatingInput");
43 | dontStoreVoteInput = document.getElementById("dontStoreVoteInput");
44 | neverVoteTwiceInput = document.getElementById("neverVoteTwiceInput");
45 | deleteDatabaseInput = document.getElementById("deleteDatabaseInput");
46 |
47 | document.getElementById("title").innerHTML = chrome.i18n.getMessage("optionsTitle");
48 | document.getElementById("maxSizeLabel").innerHTML = chrome.i18n.getMessage("maxSize");
49 | document.getElementById("minRatingLabel").innerHTML = chrome.i18n.getMessage("minRating");
50 | document.getElementById("autoHideDelayLabel").innerHTML = chrome.i18n.getMessage("autoHideDelay");
51 | document.getElementById("autoFeedbackDelayLabel").innerHTML = chrome.i18n.getMessage("autoFeedbackDelay");
52 | document.getElementById("alwaysAutoSubmitLabel").innerHTML = chrome.i18n.getMessage("alwaysAutoSubmit");
53 | document.getElementById("neverVoteTwiceLabel").innerHTML = chrome.i18n.getMessage("neverVoteTwice");
54 | document.getElementById("dontStoreVoteLabel").innerHTML = chrome.i18n.getMessage("dontStoreVote");
55 | document.getElementById("deleteDatabaseLabel").innerHTML = chrome.i18n.getMessage("deleteDatabase");
56 | document.getElementById("deleteDatabaseInput").innerHTML = chrome.i18n.getMessage("deleteDatabaseInput");
57 | maxSizeInput.options[0] = new Option(chrome.i18n.getMessage("maxSizeShowAll"), -1);
58 | maxSizeInput.options[1] = new Option("50", 50);
59 | maxSizeInput.options[2] = new Option("20", 20);
60 | maxSizeInput.options[3] = new Option("10", 10);
61 | maxSizeInput.options[4] = new Option("5", 5);
62 | autoHideDelayInput.options[0] = new Option(chrome.i18n.getMessage("autoHideDelayNever"), -1);
63 | autoHideDelayInput.options[1] = new Option(chrome.i18n.getMessage("autoHideDelay5s"), 5);
64 | autoHideDelayInput.options[2] = new Option(chrome.i18n.getMessage("autoHideDelay10s"), 10);
65 | autoHideDelayInput.options[3] = new Option(chrome.i18n.getMessage("autoHideDelay20s"), 20);
66 | autoFeedbackDelayInput.options[0] = new Option(chrome.i18n.getMessage("autoFeedbackDelayNever"), -2);
67 | autoFeedbackDelayInput.options[1] = new Option(chrome.i18n.getMessage("autoFeedbackDelayAfterSubmit"), -1);
68 | autoFeedbackDelayInput.options[2] = new Option(chrome.i18n.getMessage("autoFeedbackDelay0s"), 0);
69 | autoFeedbackDelayInput.options[3] = new Option(chrome.i18n.getMessage("autoFeedbackDelay5s"), 5);
70 | autoFeedbackDelayInput.options[4] = new Option(chrome.i18n.getMessage("autoFeedbackDelay10s"), 10);
71 | autoFeedbackDelayInput.options[5] = new Option(chrome.i18n.getMessage("autoFeedbackDelay20s"), 20);
72 |
73 | autoHideDelayInput.value = config.autoHideDelay();
74 | alwaysAutoSubmitInput.checked = config.alwaysAutoSubmit() == "alwaysAutoSubmit";
75 | dontStoreVoteInput.checked = config.dontStoreVote() == "dontStoreVote";
76 | neverVoteTwiceInput.checked = config.neverVoteTwice() == "neverVoteTwice";
77 | autoFeedbackDelayInput.value = config.autoFeedbackDelay();
78 | maxSizeInput.value = config.maxSize();
79 | minRatingInput.value = config.minRating();
80 | if (config.dynPopupUnvailable)
81 | document.getElementById("autoFeedbackDelayBlock").style.display = "none";
82 | autoFeedbackDelayInput.onchange = function() {
83 | changeAutoFeedbackDelay();
84 | };
85 | changeAutoFeedbackDelay(true);
86 |
87 | autoHideDelayInput.addEventListener("change", function() {
88 | localStorage["autoHideDelay"] = autoHideDelayInput.value;
89 | }, false);
90 | alwaysAutoSubmitInput.addEventListener("change", function() {
91 | localStorage["alwaysAutoSubmit"] = alwaysAutoSubmitInput.checked ? "alwaysAutoSubmit" : "";
92 | }, false);
93 | autoFeedbackDelayInput.addEventListener("change", function() {
94 | localStorage["autoFeedbackDelay"] = autoFeedbackDelayInput.value;
95 | }, false);
96 | maxSizeInput.addEventListener("change", function() {
97 | localStorage["maxSize"] = maxSizeInput.value;
98 | }, false);
99 | minRatingInput.addEventListener("change", function() {
100 | localStorage["minRating"] = minRatingInput.value;
101 | }, false);
102 | dontStoreVoteInput.addEventListener("change", function() {
103 | localStorage["dontStoreVote"] = dontStoreVoteInput.checked ? "dontStoreVote" : "";
104 | }, false);
105 | neverVoteTwiceInput.addEventListener("change", function() {
106 | localStorage["neverVoteTwice"] = neverVoteTwiceInput.checked ? "neverVoteTwice" : "";
107 | }, false);
108 | deleteDatabaseInput.addEventListener("click", function() {
109 | accountStorage.reset();
110 | }, false);
111 | document.getElementById('main').style.display = 'block';
112 |
--------------------------------------------------------------------------------
/WebContent/popup.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/WebContent/popup.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Gildas Lormeau
3 | * contact : gildas.lormeau gmail.com
4 | *
5 | * This file is part of BugMeNot Lite.
6 | *
7 | * BugMeNot Lite is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * BugMeNot Lite is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with BugMeNot Lite. If not, see .
19 | */
20 |
21 | var loginInput = document.getElementById("login");
22 | var yesInput = document.getElementById("yes");
23 | var noInput = document.getElementById("no");
24 | var noFeedbackInput = document.getElementById("noFeedbackInput");
25 | var tabNoFeedbackInput = document.getElementById("tabNoFeedbackInput");
26 | var siteNoFeedbackInput = document.getElementById("siteNoFeedbackInput");
27 |
28 | function answerNo() {
29 | chrome.extension.getBackgroundPage().submitFeeedBack({
30 | autoSubmit : document.getElementById("autoSubmit").checked,
31 | vote : "N",
32 | tabId : parseInt(params.tabId, 10)
33 | });
34 | close();
35 | }
36 | function answerYes() {
37 | chrome.extension.getBackgroundPage().submitFeeedBack({
38 | vote : "Y",
39 | tabId : parseInt(params.tabId, 10)
40 | });
41 | close();
42 | }
43 | function answerNoFeedback() {
44 | chrome.extension.getBackgroundPage().submitFeeedBack({
45 | tabId : parseInt(params.tabId, 10),
46 | noFeedback : true
47 | });
48 | close();
49 | }
50 | function answerCancel() {
51 | chrome.extension.getBackgroundPage().submitFeeedBack({
52 | tabId : parseInt(params.tabId, 10),
53 | cancel : true
54 | });
55 | close();
56 | }
57 | function answerNoSiteFeedback() {
58 | chrome.extension.getBackgroundPage().submitFeeedBack({
59 | tabId : parseInt(params.tabId, 10),
60 | noSiteFeedback : true
61 | });
62 | close();
63 | }
64 | function openAccount(closePopup) {
65 | chrome.extension.getBackgroundPage().submitFeeedBack({
66 | tabId : parseInt(params.tabId, 10),
67 | openAccount : true
68 | });
69 | if (closePopup)
70 | close();
71 | }
72 |
73 | loginInput.addEventListener("click", openAccount, false);
74 | yesInput.addEventListener("click", answerYes, false);
75 | noInput.addEventListener("click", answerNo, false);
76 | noFeedbackInput.addEventListener("click", answerCancel, false);
77 | tabNoFeedbackInput.addEventListener("click", answerNoFeedback, false);
78 | siteNoFeedbackInput.addEventListener("click", answerNoSiteFeedback, false);
79 | loginInput.innerHTML = decodeURI(params.login);
80 | document.getElementById("login").title = chrome.i18n.getMessage("password") + ' : "' + decodeURI(params.password) + '"';
81 | document.getElementById("autoSubmit").checked = params.autoSubmit == "yes";
82 | document.getElementById("questionPart1").innerHTML = chrome.i18n.getMessage("questionPart1");
83 | document.getElementById("questionPart2").innerHTML = chrome.i18n.getMessage("questionPart2");
84 | yesInput.innerHTML = chrome.i18n.getMessage("yes");
85 | noInput.innerHTML = chrome.i18n.getMessage("no");
86 | document.getElementById("autoSubmitLabel").innerHTML = chrome.i18n.getMessage("autoSubmit");
87 | noFeedbackInput.innerHTML = chrome.i18n.getMessage("noFeedback");
88 | tabNoFeedbackInput.innerHTML = chrome.i18n.getMessage("tabNoFeedback");
89 | siteNoFeedbackInput.innerHTML = chrome.i18n.getMessage("siteNoFeedback");
--------------------------------------------------------------------------------
/WebContent/popupCommon.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 Gildas Lormeau
3 | * contact : gildas.lormeau gmail.com
4 | *
5 | * This file is part of BugMeNot Lite.
6 | *
7 | * BugMeNot Lite is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * BugMeNot Lite is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with BugMeNot Lite. If not, see .
19 | */
20 |
21 | var params = getUrlParams();
22 | var addAccountLink = document.getElementById("addAccountLink");
23 |
24 | function getUrlParams() {
25 | var i, ret = {}, urlParams = window.location.search.substr(1).split('&'), value;
26 | for (i = 0; i < urlParams.length; i++) {
27 | value = urlParams[i].split('=');
28 | ret[value[0]] = value[1];
29 | }
30 | return ret;
31 | }
32 |
33 | function addAccount() {
34 | chrome.extension.getBackgroundPage().submitFeeedBack({
35 | tabId : parseInt(params.tabId, 10),
36 | addAccount : true
37 | });
38 | close();
39 | }
40 |
41 | addAccountLink.addEventListener("click", addAccount, false);
42 | addAccountLink.innerHTML = chrome.i18n.getMessage("addAccount");
--------------------------------------------------------------------------------
/WebContent/popupDef.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |