summaryrefslogtreecommitdiff
path: root/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui
diff options
context:
space:
mode:
Diffstat (limited to 'data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui')
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js15
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js10
-rw-r--r--data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js256
3 files changed, 128 insertions, 153 deletions
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js
index aeb279a..da4b7d5 100644
--- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js
+++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js
@@ -2,34 +2,36 @@
* GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
* *
* Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ * Copyright (C) 2014, 2015 Nik Nyby
*
- * This program is free software: you can redistribute it and/or modify
+ * This file is part of GNU LibreJS.
+ *
+ * GNU LibreJS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * GNU LibreJS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>.
*/
// this module is used to display a notification when LibreJS
// is running to inform the user it is indeed busy working.
const timer = require("sdk/timers");
const self = require("sdk/self");
-const isDisplayNotifications = require("addon_management/prefchange").isDisplayNotifications;
+const isDisplayNotifications = require("addon_management/prefchange")
+ .isDisplayNotifications;
exports.createCriticalNotification = function (text) {
if (text === undefined) {
text = "";
}
var self = require('sdk/self');
- var randomnumber = Math.floor(Math.random()*11);
var notif = require("notification-box").NotificationBox({
'value': 'librejs-critical-notification-js-web-labels',
'label': text,
@@ -53,7 +55,6 @@ exports.createNotification = function (jsValue) {
jsValue = "";
}
var self = require('sdk/self');
- var randomnumber = Math.floor(Math.random()*11);
var notif = require("notification-box").NotificationBox({
'value': 'librejs-message',
'label': 'LibreJS is analyzing: ' + jsValue + " ...",
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js
index 85c22a4..35b601c 100644
--- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js
+++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js
@@ -2,20 +2,22 @@
* GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
* *
* Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ * Copyright (C) 2014, 2015 Nik Nyby
*
- * This program is free software: you can redistribute it and/or modify
+ * This file is part of GNU LibreJS.
+ *
+ * GNU LibreJS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * GNU LibreJS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>.
*/
var urlHandler = require("url_handler/url_handler");
diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js
index 5e0c2a8..6df8a09 100644
--- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js
+++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js
@@ -2,35 +2,32 @@
* GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
* *
* Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
+ * Copyright (C) 2014, 2015 Nik Nyby
*
- * This program is free software: you can redistribute it and/or modify
+ * This file is part of GNU LibreJS.
+ *
+ * GNU LibreJS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * GNU LibreJS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>.
*/
-
-
// page mod executing content script at every page load.
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
-
var urlHandler = require("url_handler/url_handler");
-
var pageWorker = require("sdk/page-worker");
-
var tabs = require("sdk/tabs");
-var isComplaintTab = require("addon_management/prefchange").isComplaintTab;
+var prefs = require("addon_management/prefchange");
// contain list of recently found contact links or email addresses.
var contactList = {};
@@ -57,40 +54,34 @@ const SNAIL_ADDRESS_FOUND = 'snailAddressFound';
* main pageMod.
* Find blocked script in all pages being opened.
* Launch the scripts that search for a complaint contact.
- *
+ *
*/
pageMod.PageMod({
-
- include: ['file://*','*', 'data:*', 'about:*'],
-
- contentScriptWhen: 'end',
-
- contentScriptFile: [
- data.url('complain/contact_regex.js'),
- data.url('complain/link_types.js'),
- data.url('third_party/jquery-src.js'),
- data.url('third_party/jquery.easing.1.3.js'),
- data.url('complain/contact_finder.js'),
- data.url('complain/pagemod_finder.js'),
- data.url('script_detector/script_detector.js')
- ],
-
- onAttach: function onAttach(worker) {
-
- if (worker.tab !== undefined && isComplaintTab()) {
-
- // this is a tab.
- if (!foundInContactList(worker.url)) {
- // the hostname doesn't appear in the object literal.
- // run script fetching/complaint feature if applicable.
- tabProcess(worker);
- } else {
- worker.postMessage(foundInContactList(worker.url));
- }
- }
-
- }
+ include: ['file://*', '*', 'data:*', 'about:*'],
+ contentScriptWhen: 'end',
+
+ contentScriptFile: [
+ data.url('complain/contact_regex.js'),
+ data.url('complain/link_types.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
+ data.url('complain/contact_finder.js'),
+ data.url('complain/pagemod_finder.js'),
+ data.url('script_detector/script_detector.js')
+ ],
+
+ onAttach: function onAttach(worker) {
+ if (worker.tab !== undefined && prefs.isComplaintTab()) {
+ // this is a tab.
+ if (!foundInContactList(worker.url)) {
+ // the hostname doesn't appear in the object literal.
+ // run script fetching/complaint feature if applicable.
+ tabProcess(worker);
+ } else {
+ worker.postMessage(foundInContactList(worker.url));
+ }
+ }
+ }
});
/**
@@ -100,92 +91,81 @@ pageMod.PageMod({
* false.
*/
var foundInContactList = function (url) {
-
- var hostname = urlHandler.getHostname(url);
-
- if (contactList[hostname] !== undefined) {
-
- return contactList[hostname];
-
- } else {
-
- return false;
-
- }
-
+ var hostname = urlHandler.getHostname(url);
+ if (contactList[hostname] !== undefined) {
+ return contactList[hostname];
+ } else {
+ return false;
+ }
};
/**
* tabProcess
* Find blocked/accepted scripts, prepare
- * display panel and complaint panel, ...
- *
+ * display panel and complaint panel.
*/
var tabProcess = function (worker) {
-
- var visitedUrl = {};
-
- // webmaster email is better than a webpage.
- worker.emailFound = false;
- var modUrl = '',
- searchUrl = '';
-
- modUrl = worker.url;
-
- console.debug('pagemod triggered');
-
- // send local path to complain button graphic.
- worker.postMessage({'event': 'assets-uri', 'value': data.url('assets/')});
- worker.postMessage({'event': 'page-url', 'value': modUrl});
-
- worker.on('message', function (respData) {
-
- // console.debug('worker is receiving a message', respData.event);
-
- var pw;
-
- worker.on('detach', function () {
- console.debug('detaching worker');
- if (pw) {
- pw.destroy();
-
- }
- });
- if (respData.contact !== undefined) {
- // pass the message to the complaint display panel.
- worker.postMessage(respData);
- }
-
- else if (respData.event === 'complaintSearch') {
-
- console.debug('complaintSearch triggered');
- console.debug('worker tab url', worker.tab.url);
- if (!(respData.urlSearch.linkValue in visitedUrl)) {
-
- visitedUrl[respData.urlSearch.linkValue] = 1;
-
- respData.urlSearch.linkValue = urlHandler.addFragment(respData.urlSearch.linkValue, 'librejs=true');
- pw = searchSecondLevelPage(this, respData.urlSearch.linkValue, this.url);
-
- }
- // currently not needed.
- /*else {
- console.debug(respData.urlSearch.linkValue, 'already visited');
- }*/
- }
-
-
- });
-
+ var visitedUrl = {};
+
+ // webmaster email is better than a webpage.
+ worker.emailFound = false;
+ var modUrl = '',
+ searchUrl = '';
+
+ modUrl = worker.url;
+ console.debug('pagemod triggered');
+
+ worker.port.emit('prefs', {
+ complaintEmailSubject: prefs.complaintEmailSubject(),
+ complaintEmailBody: prefs.complaintEmailBody()
+ });
+
+ // send local path to complain button graphic.
+ worker.port.emit('assetsUri',
+ {'event': 'assets-uri',
+ 'value': data.url('assets/')});
+ worker.port.emit('pageUrl',
+ {'event': 'page-url',
+ 'value': modUrl});
+
+ worker.on('message', function (respData) {
+ console.debug('worker is receiving a message', respData.event);
+ var pw;
+
+ worker.on('detach', function () {
+ console.debug('detaching worker');
+ if (pw) {
+ pw.destroy();
+ }
+ });
+ if (respData.contact !== undefined) {
+ // pass the message to the complaint display panel.
+ worker.port.emit('complaintLinkFound', respData);
+ } else if (respData.event === 'complaintSearch') {
+ if (worker.tab) {
+ console.debug('worker tab url', worker.tab.url);
+ }
+ if (!(respData.urlSearch.linkValue in visitedUrl)) {
+ visitedUrl[respData.urlSearch.linkValue] = 1;
+ respData.urlSearch.linkValue = urlHandler.addFragment(
+ respData.urlSearch.linkValue, 'librejs=true');
+ pw = searchSecondLevelPage(
+ this, respData.urlSearch.linkValue, this.url);
+ }
+ // currently not needed.
+ /*else {
+ console.debug(respData.urlSearch.linkValue, 'already visited');
+ }*/
+ }
+ });
};
var searchSecondLevelPage = function(
- worker, urlToSearch, originalUrl) {
+ worker, urlToSearch, originalUrl) {
return;
var originalWorker = worker;
- console.debug('url to search is', urlToSearch);
-
+ console.debug('searchSecondLevelPage');
console.debug(urlToSearch, 'and', originalUrl);
if (urlHandler.haveSameHostname(urlToSearch, originalUrl)) {
@@ -194,39 +174,31 @@ var searchSecondLevelPage = function(
contentScriptFile: [
data.url('complain/contact_regex.js'),
data.url('complain/link_types.js'),
- data.url('third_party/jquery-src.js'),
- data.url('third_party/jquery.easing.1.3.js'),
+ data.url('settings/third-party/jquery/jquery.min.js'),
data.url('complain/contact_finder.js'),
data.url('complain/worker_finder.js')
- ],
- contentScriptWhen: "end",
- onMessage: function (respData) {
- console.debug(JSON.stringify(respData));
- console.debug(originalWorker.url);
- originalWorker.postMessage(respData);
-
- if (respData.event === 'destroy') {
- try {
- console.debug('destroying worker', this.contentURL);
- this.destroy();
- } catch (e) {
- console.debug('in worker', e);
- }
- }
- }
+ ],
+ contentScriptWhen: "end",
+ onMessage: function (respData) {
+ console.debug(JSON.stringify(respData));
+ console.debug(originalWorker.url);
+ originalWorker.postMessage(respData);
+
+ if (respData.event === 'destroy') {
+ try {
+ console.debug('destroying worker', this.contentURL);
+ this.destroy();
+ } catch (e) {
+ console.debug('in worker', e);
+ }
+ }
+ }
});
}
};
-
-
-
exports.testModule = {
-
- 'contactList': contactList,
-
- 'foundInContactList': foundInContactList,
-
- 'tabProcess': tabProcess
-
+ 'contactList': contactList,
+ 'foundInContactList': foundInContactList,
+ 'tabProcess': tabProcess
};