summaryrefslogtreecommitdiff
path: root/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2020-01-03 00:22:19 -0500
committerAmin Bandali <bandali@gnu.org>2020-01-03 01:29:32 -0500
commite0018643e5cebc35a3786ffe04a323b03cd662b4 (patch)
tree56d327df66c1295d851fb35fe5f52c42a286dfde /data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround
parent85e99badac11983f6d50b0d9942f66a30f55b8e5 (diff)
Remove old extensions and add the reworked workarounds extension
* data/update-extensions.sh: Remove free-js-for-rsf-org-petitions, librejs-compatible-sumofus-org, librejs-compatible-pay-gov, rock-and-roll-mcdonald-s, goteo-org-payments-w-free-js, use-google-drive-with-librejs. These have been reworked and are all now bundled into one single extension. * data/extensions/DMCAreg@0xbeef.coffee/*, data/extensions/SimpleSumOfUs@0xbeef.coffee/*, data/extensions/google_drive@0xbeef.coffee/*, data/extensions/goteo@0xbeef.coffee/*, data/extensions/rsf@0xbeef.coffee/*, data/extensions/rnrMcDonalds@0xbeef.coffee/*: Remove. * data/extensions/gnuzilla-ext-workarounds@gnu.org/LICENSE, data/extensions/gnuzilla-ext-workarounds@gnu.org/README, data/extensions/gnuzilla-ext-workarounds@gnu.org/README~, data/extensions/gnuzilla-ext-workarounds@gnu.org/background.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/background.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/html/domestic.html, data/extensions/gnuzilla-ext-workarounds@gnu.org/html/domestic.html~, data/extensions/gnuzilla-ext-workarounds@gnu.org/html/domestic.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/html/jquery-3.4.1.min.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/html/usps_postage.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/html/usps_postage.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/icons/L4Libre.png, data/extensions/gnuzilla-ext-workarounds@gnu.org/icons/L4Libre128.png, data/extensions/gnuzilla-ext-workarounds@gnu.org/icons/L4Libre48.png, data/extensions/gnuzilla-ext-workarounds@gnu.org/icons/test.png, data/extensions/gnuzilla-ext-workarounds@gnu.org/jquery-3.4.1.min.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/manifest.json, data/extensions/gnuzilla-ext-workarounds@gnu.org/manifest.json~, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js~, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js, data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js~: New files. These were imported from the "integrated addon" directory of https://0xbeef.coffee/final4.zip, extracted using: unzip final4.zip "final/integrated addon/*" -d gnuzilla-ext-workarounds@gnu.org/ mv "gnuzilla-ext-workarounds@gnu.org/final/integrated addon"/* gnuzilla-ext-workarounds@gnu.org/ rm -rf gnuzilla-ext-workarounds@gnu.org/final/ add original backup files
Diffstat (limited to 'data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround')
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js121
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js~122
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js121
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js~122
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js75
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js~76
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js149
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js~150
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js43
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js~44
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js158
-rw-r--r--data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js~159
12 files changed, 1340 insertions, 0 deletions
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js
new file mode 100644
index 0000000..22ef004
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js
@@ -0,0 +1,121 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+
+ 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/>.
+
+*/
+if(document.location.href.indexOf("docs.google.com") != -1){
+ console.log("googledocs_main.js");
+ function parseURL(a){
+ let url = new URL(a);
+ var result = Object.create(null);
+ for(let i of url.searchParams) {
+ result[i[0]] = i[1];
+ }
+ return JSON.stringify(result, undefined, 4);
+ }
+ var id;
+ var url;
+ function form_check(){
+ console.log("boop");
+ var format = "";
+ var input = document.getElementsByTagName("input");
+ if(input[input.length-1].value != "Expected 3 letter file extension"){
+ format = input[input.length-1].value;
+ } else{
+ for(var i = 0; i < input.length-1; i++){
+ if(input[i].value != ""){
+ format = input[i].value;
+ break;
+ }
+ }
+ if(format == ""){
+ return 0;
+ }
+ }
+
+ // Supposed to look like this:
+ // https://docs.google.com/document/export?format=FORMAT&id=ID
+ // Thanks to Alyssa Rosenzweig.
+ var new_url = 'https://docs.google.com/document/export?format='+format+'&id='+id;
+ document.location.assign(new_url);
+ return 0;
+ }
+
+
+ var contains_apostrophe = "You don't really want to store your data in a cloudy service do you?";
+ var opts_form =
+ ' <br>'+
+ ' <h1>Google Drive without non-free Javascript</h1>'+
+ ' '+contains_apostrophe+'<br><br><br>'+
+ ' <div id="opts">'+
+ ' <b>Please select the format to download in:</b><br><br>'+
+ ' <input type="radio" name="format" value="txt"> Plain text ("txt")<br>'+
+ ' <input type="radio" name="format" value="odt"> ODT ("odt")<br><br>'+
+ ' Or try to get the document in a different format, '+
+ ' ("png", "avi", "pdf", etc..):<br><br>'+
+ ' <input type="text" value="Expected 3 letter file extension"><br><br>'+
+ ' <button id="submit">Go fetch the document<br>'+
+ ' </div>'+
+ ''+
+ ''+
+ '';
+
+ // see if its a document or not.
+ function check_valid(){
+ id = "no ID found.";
+ var url_arr = document.location.href.split("/");
+ for(var i = 0; i < url_arr.length-1; i++){
+ if(url_arr[i] == "d"){
+ id = url_arr[i+1];
+ break;
+ }
+ if(url_arr[i].indexOf("id=") != -1){
+ id = document.location.href.substring(url_arr[i].indexOf("id=")+3,document.location.href.length);
+ break;
+ }
+ }
+ console.log(id);
+ if(id == "no ID found."){
+ // do nothing because it could be an info page or something
+ console.log("no id found.");
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+
+
+ function main(){
+
+ if(check_valid()){
+ console.log("---------------------------------"+Date.now()+":Detected Google Drive."+"---------------------------------");
+ window.stop();
+ document.head.innerHTML = "";
+ document.body.innerHTML = opts_form;
+ document.body.style.textAlign = "center";
+ document.getElementById("opts").style.textAlign = "left";
+ //document.getElementsById("opts").style.float = "left";
+ document.body.style.marginTop = "2%"
+ document.body.style.marginLeft = "25%"
+ document.body.style.marginRight = "25%"
+ document.getElementById("submit").addEventListener("click",form_check);
+ }
+ return 0;
+ }
+ main();
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js~ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js~
new file mode 100644
index 0000000..127aba6
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/googledocs_main.js~
@@ -0,0 +1,122 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+ Copyright (C) 2019 Free Software Foundation
+
+ 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/>.
+
+*/
+if(document.location.href.indexOf("docs.google.com") != -1){
+ console.log("googledocs_main.js");
+ function parseURL(a){
+ let url = new URL(a);
+ var result = Object.create(null);
+ for(let i of url.searchParams) {
+ result[i[0]] = i[1];
+ }
+ return JSON.stringify(result, undefined, 4);
+ }
+ var id;
+ var url;
+ function form_check(){
+ console.log("boop");
+ var format = "";
+ var input = document.getElementsByTagName("input");
+ if(input[input.length-1].value != "Expected 3 letter file extension"){
+ format = input[input.length-1].value;
+ } else{
+ for(var i = 0; i < input.length-1; i++){
+ if(input[i].value != ""){
+ format = input[i].value;
+ break;
+ }
+ }
+ if(format == ""){
+ return 0;
+ }
+ }
+
+ // Supposed to look like this:
+ // https://docs.google.com/document/export?format=FORMAT&id=ID
+ // Thanks to Alyssa Rosenzweig.
+ var new_url = 'https://docs.google.com/document/export?format='+format+'&id='+id;
+ document.location.assign(new_url);
+ return 0;
+ }
+
+
+ var contains_apostrophe = "You don't really want to store your data in a cloudy service do you?";
+ var opts_form =
+ ' <br>'+
+ ' <h1>Google Drive without non-free Javascript</h1>'+
+ ' '+contains_apostrophe+'<br><br><br>'+
+ ' <div id="opts">'+
+ ' <b>Please select the format to download in:</b><br><br>'+
+ ' <input type="radio" name="format" value="txt"> Plain text ("txt")<br>'+
+ ' <input type="radio" name="format" value="odt"> ODT ("odt")<br><br>'+
+ ' Or try to get the document in a different format, '+
+ ' ("png", "avi", "pdf", etc..):<br><br>'+
+ ' <input type="text" value="Expected 3 letter file extension"><br><br>'+
+ ' <button id="submit">Go fetch the document<br>'+
+ ' </div>'+
+ ''+
+ ''+
+ '';
+
+ // see if its a document or not.
+ function check_valid(){
+ id = "no ID found.";
+ var url_arr = document.location.href.split("/");
+ for(var i = 0; i < url_arr.length-1; i++){
+ if(url_arr[i] == "d"){
+ id = url_arr[i+1];
+ break;
+ }
+ if(url_arr[i].indexOf("id=") != -1){
+ id = document.location.href.substring(url_arr[i].indexOf("id=")+3,document.location.href.length);
+ break;
+ }
+ }
+ console.log(id);
+ if(id == "no ID found."){
+ // do nothing because it could be an info page or something
+ console.log("no id found.");
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+
+
+ function main(){
+
+ if(check_valid()){
+ console.log("---------------------------------"+Date.now()+":Detected Google Drive."+"---------------------------------");
+ window.stop();
+ document.head.innerHTML = "";
+ document.body.innerHTML = opts_form;
+ document.body.style.textAlign = "center";
+ document.getElementById("opts").style.textAlign = "left";
+ //document.getElementsById("opts").style.float = "left";
+ document.body.style.marginTop = "2%"
+ document.body.style.marginLeft = "25%"
+ document.body.style.marginRight = "25%"
+ document.getElementById("submit").addEventListener("click",form_check);
+ }
+ return 0;
+ }
+ main();
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js
new file mode 100644
index 0000000..dd225e2
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js
@@ -0,0 +1,121 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+
+ 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/>.
+
+*/
+if(document.location.href.indexOf("pgw.ceca.es") != -1
+ || document.location.href.indexOf("goteo.org") != -1
+ || document.location.href.indexOf("sis.sermepa.es") != -1
+ ){
+ console.log("goteo_main.js");
+ function update_currency(){
+ var curr = document.getElementById("currency_select").selectedOptions[0].innerHTML;
+ var value = document.getElementsByName("Importe")[0].value;
+ value = value.substr(0,value.length-2) + "," + value.substr(value.length-2,value.length)+" "+curr;
+ document.getElementById("imp").innerText = value;
+ var currency = document.getElementsByName("TipoMoneda")[0];
+ currency.value = document.getElementById("currency_select").value;
+ }
+
+ if(document.location.href.indexOf("sermepa.es/sis") != -1){
+ console.log("sis.sermepa.es");
+ document.forms[0].submit();
+ }
+
+
+ if(document.domain.indexOf("goteo.org") == -1){
+
+ var currency_options = '<div class="box mgt"><div class="izq"><label class="bloque">Currency/moneda:</label><select id="currency_select"><option value="978">EUR</option></select></div></div>';
+ document.getElementById("pago_tarjeta").insertAdjacentHTML("beforeend",currency_options);
+ document.getElementById("currency_select").addEventListener("change", update_currency);
+
+ // Generate correct year options
+ var d = new Date();
+ var n = d.getFullYear();
+ var opts = "";
+
+ for(var i = 0; i < 15; i++){
+ var cy = n+i;
+ opts += "<option value='"+cy+"'>"+cy+"</option>\n";
+ }
+
+ document.getElementsByName("elanyo")[0].insertAdjacentHTML("afterbegin",opts);
+ document.body.insertAdjacentHTML("afterbegin","<h1>3rd party Javascript activated because you downloaded an add-on to use this page with free Javascript. If you are not running LibreJS, disable this add-on or reload with it enabled.</h1>");
+ document.getElementsByTagName("h1")[0].style.display = "inline";
+ document.getElementsByTagName("h1")[0].style.color = "red";
+
+ document.getElementById("visa").children[0];
+ document.getElementById("tarjetero").children[0];
+ document.getElementById("masterpass").children[0];
+
+
+ var a = document.getElementsByClassName("izq divizq")[0];
+ a.addEventListener("click",function(){
+ if(document.getElementById("visa").children[0].checked){
+ document.getElementById("pago_tarjeta").style.display = "block";
+ document.getElementById("pago_tarjetero").style.display = "none";
+ document.getElementById("pago_masterpass").style.display = "none";
+ }
+ if(document.getElementById("tarjetero").children[0].checked){
+ document.getElementById("pago_tarjeta").style.display = "none";
+ document.getElementById("pago_tarjetero").style.display = "block";
+ document.getElementById("pago_masterpass").style.display = "none";
+ }
+ if(document.getElementById("masterpass").children[0].checked){
+ document.getElementById("pago_tarjeta").style.display = "none";
+ document.getElementById("pago_tarjetero").style.display = "none";
+ document.getElementById("pago_masterpass").style.display = "block";
+ }
+ });
+
+ a.click();
+
+ document.getElementById("pagar").addEventListener("click",function(){
+ // Read the inputs and set the form values:
+ // expire date
+ var expire = document.getElementsByName("Caducidad")[0];
+ expire.value = document.getElementsByName("elanyo")[0].value+document.getElementsByName("elmes")[0].value;
+ // currency code
+ var currency = document.getElementsByName("TipoMoneda")[0];
+ currency.value = document.getElementById("currency_select").value;
+
+ document.getElementsByTagName("form")[0].submit();
+ });
+
+ var num_op = document.getElementsByName("Num_operacion")[0].value;
+ document.getElementById("numoperacion").innerText = num_op;
+ document.getElementById("CSC").style.display = "none";
+ document.getElementById("mc_S_ico").style.display = "none";
+ document.getElementById("visa_S_ico").style.display = "none";
+ document.getElementById("mc_S_ico").style.display = "none";
+ document.getElementById("amex_ico").style.display = "none";
+
+ var value = document.getElementsByName("Importe")[0].value;
+ value = value.substr(0,value.length-2) + "," + value.substr(value.length-2,value.length) + " EUR";
+ document.getElementById("imp").innerText = value;
+ } else{
+ console.log("goteo");
+ // this needs to happen twice for some reason
+ var dropdown = document.getElementsByClassName("dropdown-menu language-dropbox");
+ var a = [];
+ for(var i = 0; i < dropdown.length; i++){
+ a.push(dropdown[i])
+ }
+ for(var i = 0; i < a.length; i++){
+ a[i].className = "";
+ }
+ }
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js~ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js~
new file mode 100644
index 0000000..56820fe
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/goteo_main.js~
@@ -0,0 +1,122 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+ Copyright (C) 2019 Free Software Foundation
+
+ 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/>.
+
+*/
+if(document.location.href.indexOf("pgw.ceca.es") != -1
+ || document.location.href.indexOf("goteo.org") != -1
+ || document.location.href.indexOf("sis.sermepa.es") != -1
+ ){
+ console.log("goteo_main.js");
+ function update_currency(){
+ var curr = document.getElementById("currency_select").selectedOptions[0].innerHTML;
+ var value = document.getElementsByName("Importe")[0].value;
+ value = value.substr(0,value.length-2) + "," + value.substr(value.length-2,value.length)+" "+curr;
+ document.getElementById("imp").innerText = value;
+ var currency = document.getElementsByName("TipoMoneda")[0];
+ currency.value = document.getElementById("currency_select").value;
+ }
+
+ if(document.location.href.indexOf("sermepa.es/sis") != -1){
+ console.log("sis.sermepa.es");
+ document.forms[0].submit();
+ }
+
+
+ if(document.domain.indexOf("goteo.org") == -1){
+
+ var currency_options = '<div class="box mgt"><div class="izq"><label class="bloque">Currency/moneda:</label><select id="currency_select"><option value="978">EUR</option></select></div></div>';
+ document.getElementById("pago_tarjeta").insertAdjacentHTML("beforeend",currency_options);
+ document.getElementById("currency_select").addEventListener("change", update_currency);
+
+ // Generate correct year options
+ var d = new Date();
+ var n = d.getFullYear();
+ var opts = "";
+
+ for(var i = 0; i < 15; i++){
+ var cy = n+i;
+ opts += "<option value='"+cy+"'>"+cy+"</option>\n";
+ }
+
+ document.getElementsByName("elanyo")[0].insertAdjacentHTML("afterbegin",opts);
+ document.body.insertAdjacentHTML("afterbegin","<h1>3rd party Javascript activated because you downloaded an add-on to use this page with free Javascript. If you are not running LibreJS, disable this add-on or reload with it enabled.</h1>");
+ document.getElementsByTagName("h1")[0].style.display = "inline";
+ document.getElementsByTagName("h1")[0].style.color = "red";
+
+ document.getElementById("visa").children[0];
+ document.getElementById("tarjetero").children[0];
+ document.getElementById("masterpass").children[0];
+
+
+ var a = document.getElementsByClassName("izq divizq")[0];
+ a.addEventListener("click",function(){
+ if(document.getElementById("visa").children[0].checked){
+ document.getElementById("pago_tarjeta").style.display = "block";
+ document.getElementById("pago_tarjetero").style.display = "none";
+ document.getElementById("pago_masterpass").style.display = "none";
+ }
+ if(document.getElementById("tarjetero").children[0].checked){
+ document.getElementById("pago_tarjeta").style.display = "none";
+ document.getElementById("pago_tarjetero").style.display = "block";
+ document.getElementById("pago_masterpass").style.display = "none";
+ }
+ if(document.getElementById("masterpass").children[0].checked){
+ document.getElementById("pago_tarjeta").style.display = "none";
+ document.getElementById("pago_tarjetero").style.display = "none";
+ document.getElementById("pago_masterpass").style.display = "block";
+ }
+ });
+
+ a.click();
+
+ document.getElementById("pagar").addEventListener("click",function(){
+ // Read the inputs and set the form values:
+ // expire date
+ var expire = document.getElementsByName("Caducidad")[0];
+ expire.value = document.getElementsByName("elanyo")[0].value+document.getElementsByName("elmes")[0].value;
+ // currency code
+ var currency = document.getElementsByName("TipoMoneda")[0];
+ currency.value = document.getElementById("currency_select").value;
+
+ document.getElementsByTagName("form")[0].submit();
+ });
+
+ var num_op = document.getElementsByName("Num_operacion")[0].value;
+ document.getElementById("numoperacion").innerText = num_op;
+ document.getElementById("CSC").style.display = "none";
+ document.getElementById("mc_S_ico").style.display = "none";
+ document.getElementById("visa_S_ico").style.display = "none";
+ document.getElementById("mc_S_ico").style.display = "none";
+ document.getElementById("amex_ico").style.display = "none";
+
+ var value = document.getElementsByName("Importe")[0].value;
+ value = value.substr(0,value.length-2) + "," + value.substr(value.length-2,value.length) + " EUR";
+ document.getElementById("imp").innerText = value;
+ } else{
+ console.log("goteo");
+ // this needs to happen twice for some reason
+ var dropdown = document.getElementsByClassName("dropdown-menu language-dropbox");
+ var a = [];
+ for(var i = 0; i < dropdown.length; i++){
+ a.push(dropdown[i])
+ }
+ for(var i = 0; i < a.length; i++){
+ a[i].className = "";
+ }
+ }
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js
new file mode 100644
index 0000000..33f26d6
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js
@@ -0,0 +1,75 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+
+ 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/>.
+
+*/
+if(document.location.href.indexOf("login-mcd-cluster.prd.snantx.attwifi.com") != -1){
+ console.log("mcdonalds_wifi.js");
+ console.log("Detected new style captive portal.");
+ document.forms[0].submit();
+}
+
+
+// It seems McDonald's captive portal has changed and it no longer
+// uses this captive portal. This will be left here in case there
+// are some places where the old style captive portal is still in
+// use.
+if(document.location.href.indexOf("wayport.net") != -1){
+ console.log("mcdonalds_wifi.js");
+ console.log("Detected old style captive portal.");
+
+ console.log("Detected the McDonald's captive portal.")
+ var form = document.getElementsByTagName("form");
+ var entries = form[0].getElementsByTagName("input");
+ var data = new FormData();
+ captive_portal_url = "wayport.net"
+ if ("undefined" === typeof(document.getElementsByTagName("form")[0].action)) {
+ console.log("no form found.")
+ } else{
+ document.body.style.border = "5px solid red";
+ post_url = document.getElementsByTagName("form")[0].action;
+ var dest = "";
+ for(var i = 0; i < entries.length; i++){
+ console.log(entries[i].name + ":" + entries[i].value);
+
+ if(entries[i].name == "origDest"){
+ dest = entries[i].name;
+ entries[i].value = "http://www.wikipedia.org";
+ }
+ // Seems like this should be set to 1, not sure if required though
+ if(entries[i].name == "connect"){
+ entries[i].value = "1";
+ }
+
+ data.append(entries[i].name,entries[i].value);
+
+ }
+ var http = new XMLHttpRequest();
+ //auth_url = document.URL.substring(0,document.URL.indexOf(captive_portal_url)+captive_portal_url.length);
+ //auth_url += post_url;
+ console.log(data);
+ console.log(post_url);
+ var xhr = new XMLHttpRequest();
+ xhr.open('POST', post_url, true);
+ xhr.onload = function () {
+ // do something to response
+ //console.log(this.responseText);
+ document.body = this.responseText;
+ };
+ xhr.send(data);
+ alert("Authenticated to McDonald's Wi-fi.")
+ }
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js~ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js~
new file mode 100644
index 0000000..3394b61
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/mcdonalds_wifi.js~
@@ -0,0 +1,76 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+ Copyright (C) 2019 Free Software Foundation
+
+ 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/>.
+
+*/
+if(document.location.href.indexOf("login-mcd-cluster.prd.snantx.attwifi.com") != -1){
+ console.log("mcdonalds_wifi.js");
+ console.log("Detected new style captive portal.");
+ document.forms[0].submit();
+}
+
+
+// It seems McDonald's captive portal has changed and it no longer
+// uses this captive portal. This will be left here in case there
+// are some places where the old style captive portal is still in
+// use.
+if(document.location.href.indexOf("wayport.net") != -1){
+ console.log("mcdonalds_wifi.js");
+ console.log("Detected old style captive portal.");
+
+ console.log("Detected the McDonald's captive portal.")
+ var form = document.getElementsByTagName("form");
+ var entries = form[0].getElementsByTagName("input");
+ var data = new FormData();
+ captive_portal_url = "wayport.net"
+ if ("undefined" === typeof(document.getElementsByTagName("form")[0].action)) {
+ console.log("no form found.")
+ } else{
+ document.body.style.border = "5px solid red";
+ post_url = document.getElementsByTagName("form")[0].action;
+ var dest = "";
+ for(var i = 0; i < entries.length; i++){
+ console.log(entries[i].name + ":" + entries[i].value);
+
+ if(entries[i].name == "origDest"){
+ dest = entries[i].name;
+ entries[i].value = "http://www.wikipedia.org";
+ }
+ // Seems like this should be set to 1, not sure if required though
+ if(entries[i].name == "connect"){
+ entries[i].value = "1";
+ }
+
+ data.append(entries[i].name,entries[i].value);
+
+ }
+ var http = new XMLHttpRequest();
+ //auth_url = document.URL.substring(0,document.URL.indexOf(captive_portal_url)+captive_portal_url.length);
+ //auth_url += post_url;
+ console.log(data);
+ console.log(post_url);
+ var xhr = new XMLHttpRequest();
+ xhr.open('POST', post_url, true);
+ xhr.onload = function () {
+ // do something to response
+ //console.log(this.responseText);
+ document.body = this.responseText;
+ };
+ xhr.send(data);
+ alert("Authenticated to McDonald's Wi-fi.")
+ }
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js
new file mode 100644
index 0000000..f94981f
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js
@@ -0,0 +1,149 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+
+ 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/>.
+
+*/
+
+if(document.location.href.indexOf("copyright.gov")!= -1){
+ console.log("paygov_main.js");
+
+ var content;
+ function replace_regex(){
+ content = document.documentElement.innerHTML;
+ content = content.replace(/type\s*\=\s*("|')\s*hidden\s*\1\s*;/g,"");
+ content = content.replace(/display\s*:\s*none/g,"");
+ content = content.replace(/visibility\s*:\s*hidden/g,"");
+ document.documentElement.innerHTML = "<html>"+content+"</html>";
+ }
+
+ if(window.getComputedStyle(document.body)["display"] == "none"){
+ replace_regex();
+ }
+ function parseURL(a){
+ let url = new URL(a);
+ var result = Object.create(null);
+ for(let i of url.searchParams) {
+ result[i[0]] = i[1];
+ }
+ return JSON.stringify(result, undefined, 4);
+ }
+ function get_domain(url){
+ var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0];
+ if(url.indexOf("http://") == 0){
+ domain = "http://" + domain;
+ }
+ else if(url.indexOf("https://") == 0){
+ domain = "https://" + domain;
+ }
+ domain = domain + "/";
+ domain = domain.replace(/ /g,"");
+ return domain;
+ }
+
+ if(document.location.href.indexOf("pay.gov/tcsonline/") != -1){
+ document.getElementsByClassName("text")[0].remove();
+ console.log("detected payment page.");
+
+ if( document.getElementsByClassName("redbuttontext") !== null){
+ document.getElementsByClassName("redbuttontext")[0].remove();
+ }
+
+
+ document.getElementById("hiddenContinueButton").style.display = "";
+ document.getElementById("statesCAN").remove();
+ document.getElementById("statesUSA").remove();
+ document.getElementById("stateText").value = "2 letter code";
+ }
+
+ if(get_domain(document.location.href) == "https://dmca.copyright.gov/"){
+
+ document.body.style.display = true;
+ var csrf = document.getElementsByName("_csrf")[0].content;
+ console.log("csrf:"+csrf);
+ var form = document.getElementById("file");
+ if(form !== null){
+ console.log("upload page detected");
+ document.getElementById("btnUpload").disabled = false;
+ var xml = new XMLHttpRequest();
+ //xml.open("POST","https://dmca.copyright.gov/osp/home/alternatename/edit/alternatename.html",true);
+ var url = "https://dmca.copyright.gov/home/alternatename/edit/alternatenameajaxdisplay.html"
+ console.log("OPENING "+url);
+ xml.open("POST",url,true);
+ console.log("DONE");
+ var spid = JSON.parse(parseURL(document.location.href))["spid"];
+ console.log("spid:"+spid);
+ var payload = {
+ "draw":1,
+ "columns":[
+ {
+ "data":"name",
+ "name":"",
+ "searchable":true,
+ "orderable":true,
+ "search":{
+ "value":"",
+ "regex":false
+ }
+ },
+ {
+ "data":null,
+ "name":"",
+ "searchable":true,
+ "orderable":false,
+ "search":{
+ "value":"",
+ "regex":false
+ }
+ }
+ ],
+ "order":[
+ {
+ "column":0,
+ "dir":"asc"
+ }
+ ],
+ "start":0,
+ "length":10,
+ "search":{
+ "value":"",
+ "regex":false
+ },
+ "spid": spid
+ };
+
+ xml.onload = function(){
+ console.log(this);
+ var parser = new DOMParser();
+ var doc = parser.parseFromString(this.responseText, "text/html");
+ var error = doc.getElementsByClassName("page-head")[0];
+ if(error != undefined){
+ console.log(error.innerText.replace(/\t/g,""));
+ } else{
+ console.log(this.responseText);
+ }
+ }
+ console.log("retrieving data...");
+ xml.setRequestHeader('Accept', 'application/json');
+ xml.setRequestHeader('Content-Type', 'application/json');
+ xml.setRequestHeader("csrfHeader", csrf);
+
+ xml.send(payload);
+
+ }
+ }
+
+
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js~ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js~
new file mode 100644
index 0000000..e3ddb5c
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/paygov_main.js~
@@ -0,0 +1,150 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+ Copyright (C) 2019 Free Software Foundation
+
+ 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/>.
+
+*/
+
+if(document.location.href.indexOf("copyright.gov")!= -1){
+ console.log("paygov_main.js");
+
+ var content;
+ function replace_regex(){
+ content = document.documentElement.innerHTML;
+ content = content.replace(/type\s*\=\s*("|')\s*hidden\s*\1\s*;/g,"");
+ content = content.replace(/display\s*:\s*none/g,"");
+ content = content.replace(/visibility\s*:\s*hidden/g,"");
+ document.documentElement.innerHTML = "<html>"+content+"</html>";
+ }
+
+ if(window.getComputedStyle(document.body)["display"] == "none"){
+ replace_regex();
+ }
+ function parseURL(a){
+ let url = new URL(a);
+ var result = Object.create(null);
+ for(let i of url.searchParams) {
+ result[i[0]] = i[1];
+ }
+ return JSON.stringify(result, undefined, 4);
+ }
+ function get_domain(url){
+ var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0];
+ if(url.indexOf("http://") == 0){
+ domain = "http://" + domain;
+ }
+ else if(url.indexOf("https://") == 0){
+ domain = "https://" + domain;
+ }
+ domain = domain + "/";
+ domain = domain.replace(/ /g,"");
+ return domain;
+ }
+
+ if(document.location.href.indexOf("pay.gov/tcsonline/") != -1){
+ document.getElementsByClassName("text")[0].remove();
+ console.log("detected payment page.");
+
+ if( document.getElementsByClassName("redbuttontext") !== null){
+ document.getElementsByClassName("redbuttontext")[0].remove();
+ }
+
+
+ document.getElementById("hiddenContinueButton").style.display = "";
+ document.getElementById("statesCAN").remove();
+ document.getElementById("statesUSA").remove();
+ document.getElementById("stateText").value = "2 letter code";
+ }
+
+ if(get_domain(document.location.href) == "https://dmca.copyright.gov/"){
+
+ document.body.style.display = true;
+ var csrf = document.getElementsByName("_csrf")[0].content;
+ console.log("csrf:"+csrf);
+ var form = document.getElementById("file");
+ if(form !== null){
+ console.log("upload page detected");
+ document.getElementById("btnUpload").disabled = false;
+ var xml = new XMLHttpRequest();
+ //xml.open("POST","https://dmca.copyright.gov/osp/home/alternatename/edit/alternatename.html",true);
+ var url = "https://dmca.copyright.gov/home/alternatename/edit/alternatenameajaxdisplay.html"
+ console.log("OPENING "+url);
+ xml.open("POST",url,true);
+ console.log("DONE");
+ var spid = JSON.parse(parseURL(document.location.href))["spid"];
+ console.log("spid:"+spid);
+ var payload = {
+ "draw":1,
+ "columns":[
+ {
+ "data":"name",
+ "name":"",
+ "searchable":true,
+ "orderable":true,
+ "search":{
+ "value":"",
+ "regex":false
+ }
+ },
+ {
+ "data":null,
+ "name":"",
+ "searchable":true,
+ "orderable":false,
+ "search":{
+ "value":"",
+ "regex":false
+ }
+ }
+ ],
+ "order":[
+ {
+ "column":0,
+ "dir":"asc"
+ }
+ ],
+ "start":0,
+ "length":10,
+ "search":{
+ "value":"",
+ "regex":false
+ },
+ "spid": spid
+ };
+
+ xml.onload = function(){
+ console.log(this);
+ var parser = new DOMParser();
+ var doc = parser.parseFromString(this.responseText, "text/html");
+ var error = doc.getElementsByClassName("page-head")[0];
+ if(error != undefined){
+ console.log(error.innerText.replace(/\t/g,""));
+ } else{
+ console.log(this.responseText);
+ }
+ }
+ console.log("retrieving data...");
+ xml.setRequestHeader('Accept', 'application/json');
+ xml.setRequestHeader('Content-Type', 'application/json');
+ xml.setRequestHeader("csrfHeader", csrf);
+
+ xml.send(payload);
+
+ }
+ }
+
+
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js
new file mode 100644
index 0000000..2ca2917
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js
@@ -0,0 +1,43 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+
+ 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/>.
+
+*/
+
+if(document.location.href.indexOf("rsf.org") != -1){
+ console.log("rsf_main.js");
+ function broken_page(){
+ if(document.getElementsByClassName("col-md-4 petition-wrap")[0] === undefined){
+ return 0;
+ }
+ var iframe_src = document.getElementsByTagName("iframe")[0].src.replace(/[\s\S]+%20/g,"");
+ document.getElementsByClassName("col-md-4 petition-wrap")[0].insertAdjacentHTML("afterbegin",'<h2 style="background-color: #00ffff;"><a href="'+iframe_src+'">Click here to sign the petition</a><h2>');
+ document.getElementsByTagName("iframe")[0].remove();
+ }
+
+ function petition_page(){
+ document.getElementsByTagName("form")[0].insertAdjacentHTML("beforeend",document.getElementById("ajax-view-state-page-container").innerHTML);
+ console.log("inserted info");
+ }
+
+ if(document.location.href.match("rsf.secure.force.com/petition") !== null){
+ console.log("petition");// the page in the iframe
+ petition_page();
+ } else{
+ console.log("other page");
+ broken_page();// the one with the iframe that is a 404
+ }
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js~ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js~
new file mode 100644
index 0000000..7a9c202
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/rsf_main.js~
@@ -0,0 +1,44 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+ Copyright (C) 2019 Free Software Foundation
+
+ 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/>.
+
+*/
+
+if(document.location.href.indexOf("rsf.org") != -1){
+ console.log("rsf_main.js");
+ function broken_page(){
+ if(document.getElementsByClassName("col-md-4 petition-wrap")[0] === undefined){
+ return 0;
+ }
+ var iframe_src = document.getElementsByTagName("iframe")[0].src.replace(/[\s\S]+%20/g,"");
+ document.getElementsByClassName("col-md-4 petition-wrap")[0].insertAdjacentHTML("afterbegin",'<h2 style="background-color: #00ffff;"><a href="'+iframe_src+'">Click here to sign the petition</a><h2>');
+ document.getElementsByTagName("iframe")[0].remove();
+ }
+
+ function petition_page(){
+ document.getElementsByTagName("form")[0].insertAdjacentHTML("beforeend",document.getElementById("ajax-view-state-page-container").innerHTML);
+ console.log("inserted info");
+ }
+
+ if(document.location.href.match("rsf.secure.force.com/petition") !== null){
+ console.log("petition");// the page in the iframe
+ petition_page();
+ } else{
+ console.log("other page");
+ broken_page();// the one with the iframe that is a 404
+ }
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js
new file mode 100644
index 0000000..953c5d8
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js
@@ -0,0 +1,158 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+
+ 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/>.
+
+*/
+
+if(document.location.href.indexOf("sumofus") != -1){
+ console.log("sumofus_main.js");
+
+ function wildcard_match(str, rule) {
+ return new RegExp("^" + rule.split("*").join(".*") + "$").test(str);
+ }
+
+ var page = window.location.href;
+ /*
+ if( wildcard_match(document.getElementsByTagName("pre")[0].innerHTML,'{"follow_up_url":"*"}') ){
+ console.log(JSON.parse(document.getElementsByTagName("pre")[0].innerHTML)["follow_up_url"]);
+ }
+ */
+
+ var style = "div { top: 5%; margin-left: 10%; margin-right: 10%; background-color: white;}"
+ var sheet = document.createElement('style');
+ sheet.innerHTML = style;
+ document.body.appendChild(sheet);
+ if( wildcard_match(page,"*://*actions.sumofus.org/api/pages/*/actions") ){
+ console.log("Submitted petition")
+ //console.log("Redirecting...");
+ var link = document.body.innerText;
+ link = JSON.parse(link);
+ //console.log(link);
+ document.body.innerHTML = "<h1>You have submitted this petition.</h1>";
+ }
+
+
+ function send_data(data){
+ url = document.forms[0].action
+
+ var xhr = new XMLHttpRequest();
+ var url_encoded = "";
+ var url_encoded_pairs = [];
+ var name;
+
+ for(name in data){
+ temp = encodeURIComponent(name) + '=' + encodeURIComponent(data[name])
+ url_encoded_pairs.push(temp);
+ }
+ url_encoded = url_encoded_pairs.join('&').replace(/%20/g, '+');
+
+ xhr.addEventListener('load', function(event){
+ console.log("loaded");
+ res = JSON.parse(event.target.response);
+ url = res["follow_up_url"]
+ document.location = url;
+
+ });
+ xhr.addEventListener('error', function(event){
+ console.log("Error submitting form.");
+ });
+
+ xhr.open('POST', url);
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ xhr.send(url_encoded);
+
+ }
+
+ if( wildcard_match(page,"*://*actions.sumofus.org/a/*") ){
+ console.log("Fixing campaign page");
+
+ // Make some changes to the page so it's readable.
+
+ // because I noticed there were two of these for some reason
+ document.getElementsByTagName("button")[1].remove();
+ document.getElementsByTagName("span")[0].innerHTML = "";
+ var divs = document.getElementsByTagName("div");
+ document.getElementsByClassName("noscript-notice")[0].remove();
+
+ // If they change the HTML of the page this might break...
+ //document.getElementsByClassName("petition-bar__content")[0].children[1].children[1].innerHTML = "";
+ for ( i=0; i<document.styleSheets.length; i++) {
+ void(document.styleSheets.item(i).disabled=true);
+ }
+ // apply some basic CSS
+ var style = "div {margin: 50px; text-align: left; color: black; font-size: 12pt;}";
+ var sheet = document.createElement('style');
+ sheet.innerHTML = style;
+ document.body.appendChild(sheet);
+
+ // Make the button not submit a post request
+
+ document.getElementsByClassName("button action-form__submit-button")[0].type = "button"
+
+ // Add a listener to submit the form
+ document.getElementsByClassName("button action-form__submit-button")[0].addEventListener("click", function(){
+ entries = document.getElementsByClassName("form__content sweet-placeholder__field");
+ data = []
+ for(i = 0; i < entries.length; i++){
+ data.push(entries[i].value);
+ }
+
+ form_id = document.getElementsByName("form_id")[0].value
+ res = {
+ country: data[2],
+ email: data[0],
+ form_id: form_id,
+ name: data[1],
+ phone: data[4],
+ postal: data[3]
+ }
+
+ send_data(res);
+
+
+ });
+
+
+ } else{
+ console.log("Getting current campaigns");
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if(this["readyState"] == 4 && this["status"] == 200){
+ var campaigns = JSON.parse(this.responseText);
+ //console.log(campaigns);
+ var s = "";
+ var number = "";
+ //html_template += '<button onclick="">Show Pictures</button><br>';
+ for(var i = 0; i < campaigns.length; i += 1){
+ number = (i+1)+"/"+campaigns.length+":";
+ s = campaigns[i]["title"]+"<br>";
+ html_template += number.link(campaigns[i]["url"])+s;
+ html_template += "<img src="+'"'+campaigns[i]["image"]+'"'+"><br>";
+ }
+ document.body.innerHTML = html_template;
+ }
+ };
+
+ var html_template = "<h1>[Simple SumOfUs.org]</h1>";
+ // URL to get campaigns
+ var url = "http://actions.sumofus.org/api/pages/featured.json?language=en";
+
+ document.head.replaceWith("");
+ document.body.innerHTML = "";
+ xhr.open("GET", url);
+ xhr.send();
+ }
+}
diff --git a/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js~ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js~
new file mode 100644
index 0000000..4f12093
--- /dev/null
+++ b/data/extensions/gnuzilla-ext-workarounds@gnu.org/workaround/sumofus_main.js~
@@ -0,0 +1,159 @@
+/*
+
+ Copyright (C) 2017-2019 Nathan Nichols
+ Copyright (C) 2019 Free Software Foundation
+
+ 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/>.
+
+*/
+
+if(document.location.href.indexOf("sumofus") != -1){
+ console.log("sumofus_main.js");
+
+ function wildcard_match(str, rule) {
+ return new RegExp("^" + rule.split("*").join(".*") + "$").test(str);
+ }
+
+ var page = window.location.href;
+ /*
+ if( wildcard_match(document.getElementsByTagName("pre")[0].innerHTML,'{"follow_up_url":"*"}') ){
+ console.log(JSON.parse(document.getElementsByTagName("pre")[0].innerHTML)["follow_up_url"]);
+ }
+ */
+
+ var style = "div { top: 5%; margin-left: 10%; margin-right: 10%; background-color: white;}"
+ var sheet = document.createElement('style');
+ sheet.innerHTML = style;
+ document.body.appendChild(sheet);
+ if( wildcard_match(page,"*://*actions.sumofus.org/api/pages/*/actions") ){
+ console.log("Submitted petition")
+ //console.log("Redirecting...");
+ var link = document.body.innerText;
+ link = JSON.parse(link);
+ //console.log(link);
+ document.body.innerHTML = "<h1>You have submitted this petition.</h1>";
+ }
+
+
+ function send_data(data){
+ url = document.forms[0].action
+
+ var xhr = new XMLHttpRequest();
+ var url_encoded = "";
+ var url_encoded_pairs = [];
+ var name;
+
+ for(name in data){
+ temp = encodeURIComponent(name) + '=' + encodeURIComponent(data[name])
+ url_encoded_pairs.push(temp);
+ }
+ url_encoded = url_encoded_pairs.join('&').replace(/%20/g, '+');
+
+ xhr.addEventListener('load', function(event){
+ console.log("loaded");
+ res = JSON.parse(event.target.response);
+ url = res["follow_up_url"]
+ document.location = url;
+
+ });
+ xhr.addEventListener('error', function(event){
+ console.log("Error submitting form.");
+ });
+
+ xhr.open('POST', url);
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ xhr.send(url_encoded);
+
+ }
+
+ if( wildcard_match(page,"*://*actions.sumofus.org/a/*") ){
+ console.log("Fixing campaign page");
+
+ // Make some changes to the page so it's readable.
+
+ // because I noticed there were two of these for some reason
+ document.getElementsByTagName("button")[1].remove();
+ document.getElementsByTagName("span")[0].innerHTML = "";
+ var divs = document.getElementsByTagName("div");
+ document.getElementsByClassName("noscript-notice")[0].remove();
+
+ // If they change the HTML of the page this might break...
+ //document.getElementsByClassName("petition-bar__content")[0].children[1].children[1].innerHTML = "";
+ for ( i=0; i<document.styleSheets.length; i++) {
+ void(document.styleSheets.item(i).disabled=true);
+ }
+ // apply some basic CSS
+ var style = "div {margin: 50px; text-align: left; color: black; font-size: 12pt;}";
+ var sheet = document.createElement('style');
+ sheet.innerHTML = style;
+ document.body.appendChild(sheet);
+
+ // Make the button not submit a post request
+
+ document.getElementsByClassName("button action-form__submit-button")[0].type = "button"
+
+ // Add a listener to submit the form
+ document.getElementsByClassName("button action-form__submit-button")[0].addEventListener("click", function(){
+ entries = document.getElementsByClassName("form__content sweet-placeholder__field");
+ data = []
+ for(i = 0; i < entries.length; i++){
+ data.push(entries[i].value);
+ }
+
+ form_id = document.getElementsByName("form_id")[0].value
+ res = {
+ country: data[2],
+ email: data[0],
+ form_id: form_id,
+ name: data[1],
+ phone: data[4],
+ postal: data[3]
+ }
+
+ send_data(res);
+
+
+ });
+
+
+ } else{
+ console.log("Getting current campaigns");
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if(this["readyState"] == 4 && this["status"] == 200){
+ var campaigns = JSON.parse(this.responseText);
+ //console.log(campaigns);
+ var s = "";
+ var number = "";
+ //html_template += '<button onclick="">Show Pictures</button><br>';
+ for(var i = 0; i < campaigns.length; i += 1){
+ number = (i+1)+"/"+campaigns.length+":";
+ s = campaigns[i]["title"]+"<br>";
+ html_template += number.link(campaigns[i]["url"])+s;
+ html_template += "<img src="+'"'+campaigns[i]["image"]+'"'+"><br>";
+ }
+ document.body.innerHTML = html_template;
+ }
+ };
+
+ var html_template = "<h1>[Simple SumOfUs.org]</h1>";
+ // URL to get campaigns
+ var url = "http://actions.sumofus.org/api/pages/featured.json?language=en";
+
+ document.head.replaceWith("");
+ document.body.innerHTML = "";
+ xhr.open("GET", url);
+ xhr.send();
+ }
+}