Skip to content

Commit

Permalink
+ Fixed Chrome error (Removed exchange API calls (Currently working w…
Browse files Browse the repository at this point in the history
…ith static 11/05/17 exchanges))
  • Loading branch information
rodel77 committed May 12, 2017
1 parent 18e1799 commit 6df5298
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 132 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
node_modules/
dist/
.babelrc
web-ext-artifact
.vscode
*.zip
50 changes: 15 additions & 35 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,26 @@
import zipfile
import re

man = json.loads(open("manifest.json").read())
version = man["version"]
version = json.loads(open("manifest.json").read())["version"]
print("Building version: "+version)
print("")
print("Files >>")

man.pop('applications', None)

with open("chrome-manifest.json", "w") as outfile:
json.dump(man, outfile)

includes = ['.git']

def zipdir(path, ziph, manifest):
# ziph is zipfile handle
for file in os.listdir(path):
pj = file
if "git" not in pj and ".py" not in pj:
if pj.endswith(".json"):
if(pj!=manifest):
continue
else:
print("Manifest", file)
ziph.write(file, "./manifest.json")
else:
print(file)
ziph.write("./"+file, file)
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
pj = os.path.join(root, file)
if "git" not in pj and ".py" not in pj:
print(file)
ziph.write(pj)

if __name__ == '__main__':
print("Chrome dist:")
ff = "../spigot_graphs_chrome_"+version+".zip"
zipf = zipfile.ZipFile(ff, 'w', zipfile.ZIP_DEFLATED)
zipdir('./', zipf, "chrome-manifest.json")
zipf.close()
os.rename(ff, ff[1:])

print("Firefox dist:")
ff = "../spigot_graphs_firefox_"+version+".zip"
zipf = zipfile.ZipFile(ff, 'w', zipfile.ZIP_DEFLATED)
zipdir('./', zipf, "manifest.json")
zipf.close()
os.rename(ff, ff[1:])
print("Build ended...")
ff = "../spigot_graphs_dist_"+version+".zip"
zipf = zipfile.ZipFile(ff, 'w', zipfile.ZIP_DEFLATED)
zipdir('./', zipf)
zipf.close()
os.rename(ff, ff[1:])
print("Build ended...")
37 changes: 0 additions & 37 deletions buyers.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,7 @@
function onReady(convert, options, selector, ajax){
console.debug("[Buyers] Buyers initialized ")
// var membersDOM = document.querySelectorAll(".memberListItem");
// var buyers = new Map();
// var exchanges = {};

// var pricedSales = 0;
// var freeSales = 0;

// var csv = "Date;User;Money";

var data = getBuyersData(document.querySelectorAll(".memberListItem"));

// function pushExchange(exchange, amount){
// exchanges[exchange] = (exchanges[exchange]==undefined ? amount : exchanges[exchange]+amount)
// }

// function createBuyer(userID, exchange, price, date){
// buyers.set(userID, {exchange: exchange, price: price, date: date});
// }

// for(var i = 0; i < membersDOM.length; i++){
// var cm = membersDOM[i];
// var free = cm.querySelectorAll(".muted").length===1;
// if(!free){
// //Purchased for: *amount* *exchange*
// var pur = cm.querySelectorAll(".muted")[1].innerHTML;
// var exchange = pur.substring(pur.length-4, pur.length-1);
// var money = parseFloat(digits(pur));
// var userID = digits(cm.querySelector(".avatar").classList[1]);
// var date = cm.querySelector(".DateTime").title;
// var username = cm.querySelector(".username .StatusTooltip").innerHTML;
// createBuyer(userID, exchange, money, date);
// pushExchange(exchange, money);
// csv += `#${date};${username};${money+" "+exchange}`;
// pricedSales++;
// }else{
// freeSales++;
// }
// }

console.debug("[Buyers]", data.pricedSales, "buyers found!");

displayDashboard({
Expand Down
5 changes: 2 additions & 3 deletions changelog.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Added:
+ Added firefox support
+ Soft rewrite with pretty tweaks
Issues Fixed:
+ Fixed chrome error
1 change: 0 additions & 1 deletion chrome-manifest.json

This file was deleted.

35 changes: 0 additions & 35 deletions createdist.py

This file was deleted.

1 change: 0 additions & 1 deletion firefox.txt

This file was deleted.

2 changes: 1 addition & 1 deletion helper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const MONEY_URL = "https://api.fixer.io/latest?base=USD";
const MONEY_URL = "https://api.fixer.io/latest";

// Mini jquery
function $$(selector){
Expand Down
6 changes: 0 additions & 6 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
"https://*.fixer.io/*"
],

"applications": {
"gecko": {
"id": "[email protected]"
}
},

"content_scripts": [
{
"matches": ["https://www.spigotmc.org/*/buyers"],
Expand Down
25 changes: 16 additions & 9 deletions money.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
(function(){$.ajax({
url: MONEY_URL,
success: function(json){
// (function(){$.ajax({
// url: MONEY_URL,
// dataType: "json",
// success: function(json){

console.debug("[Request] Money request ended");
var base = "USD";
var rates = json.rates;
var rates = {"AUD":1.357,"BGN":1.8009,"BRL":3.1642,"CAD":1.3726,"CHF":1.0085,"CNY":6.9021,"CZK":24.492,"DKK":6.8509,"GBP":0.77795,"HKD":7.7895,"HRK":6.8435,"HUF":285.98,"IDR":13343.0,"ILS":3.6114,"INR":64.37,"JPY":113.9,"KRW":1128.5,"MXN":18.973,"MYR":4.3485,"NOK":8.5939,"NZD":1.4606,"PHP":49.886,"PLN":3.8897,"RON":4.1888,"RUB":57.15,"SEK":8.8838,"SGD":1.4081,"THB":34.751,"TRY":3.5839,"ZAR":13.366,"EUR":0.92081}
rates["USD"] = 1;

function getRate(from, to){
Expand Down Expand Up @@ -32,8 +34,13 @@
return options;
}

onReady(convert, getExchangesInOptions(), function(selector){
return document.querySelector(selector);
}, $.ajax);
}
})})();
setTimeout(function(){
onReady(convert, getExchangesInOptions(), function(selector){
return document.querySelector(selector);
}, $.ajax)
}, 1000);
// },
// error: function(err){
// console.log(err)
// }
// })})();

0 comments on commit 6df5298

Please sign in to comment.