summaryrefslogtreecommitdiff
path: root/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@gnu.org>2014-10-20 02:43:14 +0200
committerRuben Rodriguez <ruben@gnu.org>2014-10-20 02:44:30 +0200
commit14e6d0ed4be07a4d6bf94a141af83b7d60f1ac5f (patch)
tree9f8141f34e030eca326c1b0e39a8ba143a528dff /helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui
parent686445fab20c835b9649f2278542069a5be87546 (diff)
Make generation scripts distro-independent
Diffstat (limited to 'helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui')
-rw-r--r--helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js77
-rw-r--r--helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js73
-rw-r--r--helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js232
3 files changed, 0 insertions, 382 deletions
diff --git a/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js b/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js
deleted file mode 100644
index aeb279a..0000000
--- a/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/notification.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
- * *
- * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
- *
- * This program 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,
- * 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/>.
- *
- */
-
-// 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;
-
-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,
- 'priority': 'CRITICAL_LOW',
- 'image': self.data.url("assets/images/torchy2.png"),
- });
- return notif;
-};
-
-var fakeNotification = {
- 'close': function () {
- return;
- }
-};
-
-exports.createNotification = function (jsValue) {
- if (!isDisplayNotifications()) {
- return fakeNotification;
- }
- if (jsValue === undefined) {
- 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 + " ...",
- 'priority': 'INFO_LOW',
- 'image': self.data.url("assets/images/torchy2.png"),
- /*'buttons': [{'label': "Fine",
- 'onClick': function () { }}]*/
- });
- timer.setTimeout(function () {
- // ensure notifications are ALWAYS removed at some point.
- console.debug("removing after 2 seconds");
- try {
- var n = notif.notificationbox
- .getNotificationWithValue('librejs-message');
- n.close();
- } catch(x) {
- // do nothing
- }
- }, 2000);
- return notif;
-};
diff --git a/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js b/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js
deleted file mode 100644
index 85c22a4..0000000
--- a/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/script_panel.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
- * *
- * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
- *
- * This program 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,
- * 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/>.
- *
- */
-
-var urlHandler = require("url_handler/url_handler");
-
-/**
- * addScriptsToPanelList
- *
- * Looks for scripts that are either valid or flagged with libreJS
- *
- */
-exports.addScriptsToPanelList = function (url, respData) {
-
- var panelRemovedScripts = [];
- var panelAcceptedScripts = [];
- var panelDryRunScripts = [];
-
- // use url. remove fragment.
- url = urlHandler.removeFragment(url);
- var contents, i, reason;
-
- for (i = 0; i < respData.value.blocked.length; i++) {
- // if external script only.
- pathToUrl(respData.value.blocked[i], url);
- panelRemovedScripts.push(respData.value.blocked[i]);
- }
-
- for (i = 0; i < respData.value.accepted.length; i++) {
-
- // if external script only.
- pathToUrl(respData.value.accepted[i], url);
- panelAcceptedScripts.push(respData.value.accepted[i]);
- }
- for (i = 0; i < respData.value.dryRun.length; i++) {
- // if external script only.
- pathToUrl(respData.value.dryRun[i], url);
- panelDryRunScripts.push(respData.value.dryRun[i]);
- }
-
- return {'removed': panelRemovedScripts,
- 'accepted': panelAcceptedScripts,
- 'dryRun': panelDryRunScripts};
-};
-
-
-/**
- * pathToUrl
- *
- * convert a relative path to a url.
- *
- */
-var pathToUrl = function (scriptEntry, url) {
- if (scriptEntry.inline === false) {
- scriptEntry.url = urlHandler.resolve(url, scriptEntry.url);
- }
-};
diff --git a/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js b/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js
deleted file mode 100644
index 5e0c2a8..0000000
--- a/helpers/DATA/firefox/trisquel/extensions/jid1-KtlZuoiikVfFew@jetpack/resources/librejs/lib/ui/ui_info.js
+++ /dev/null
@@ -1,232 +0,0 @@
-/**
- * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
- * *
- * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros
- *
- * This program 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,
- * 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/>.
- *
- */
-
-
-
-// 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;
-
-// contain list of recently found contact links or email addresses.
-var contactList = {};
-
-// constants. Also available in lib/ui_info.js
-const CERTAIN_EMAIL_ADDRESS_FOUND = 'certainEmailAddressFound';
-const UNCERTAIN_EMAIL_ADDRESS_FOUND = 'uncertainEmailAddresFound';
-
-// Looking for contact links
-const CERTAIN_LINK_FOUND = 'certainLinkFound';
-const PROBABLE_LINK_FOUND = 'probableLinkFound';
-const UNCERTAIN_LINK_FOUND = 'uncertainLinkFound';
-const LINK_NOT_FOUND = 'contactLinkNotFound';
-
-// Looking for identi.ca and twitter accounts.
-const TWITTER_LINK_FOUND = 'twitterLinkFound';
-const IDENTICA_LINK_FOUND = 'identicaLinkFound';
-
-// phone number and address
-const PHONE_NUMBER_FOUND = 'phoneNumberFound';
-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));
- }
- }
-
- }
-});
-
-/**
- * foundInContactList
- *
- * Provides link if contact link is found for given url, or else
- * false.
- */
-var foundInContactList = function (url) {
-
- 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, ...
- *
- */
-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 searchSecondLevelPage = function(
- worker, urlToSearch, originalUrl) {
- return;
- var originalWorker = worker;
-
- console.debug('url to search is', urlToSearch);
-
- console.debug(urlToSearch, 'and', originalUrl);
-
- if (urlHandler.haveSameHostname(urlToSearch, originalUrl)) {
- return pageWorker.Page({
- contentURL: urlToSearch,
- 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/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);
- }
- }
- }
- });
- }
-};
-
-
-
-
-exports.testModule = {
-
- 'contactList': contactList,
-
- 'foundInContactList': foundInContactList,
-
- 'tabProcess': tabProcess
-
-};