diff --git a/static/js/functions.js b/static/js/functions.js index ef6f14b..ed96930 100644 --- a/static/js/functions.js +++ b/static/js/functions.js @@ -31,6 +31,7 @@ return { // Check browser support var isSupported = self.fetch && self._ && self.Promise; +// If not supported show error if(!isSupported) { (function() { var isMissing = []; @@ -39,6 +40,7 @@ if(!isSupported) { if(!self.Promise) isMissing.push("promise"); if(!self._) isMissing.push("lodash"); + // And a link with an error report to reddit... maybe not best way but its something var url = "https://www.reddit.com/message/compose/?to=Jubbeart"; url += "&subject="+encodeURIComponent("Missing dependencies: " + isMissing.join(" ")); url += "&message="+encodeURIComponent("Comment (optional): "); @@ -112,6 +114,7 @@ return { } }})(); + var URLs = (function(){ var reddit = "https://oauth.reddit.com"; var pushshift = "https://api.pushshift.io"; @@ -147,6 +150,7 @@ return { })(); +// UTC time handling, very usefull when dealing with elasticsearch var Time = (function(){ return { utc: function() { @@ -161,11 +165,11 @@ return { times = _.parseInt(parts[0]); } - if(_.includes(timeString, "hour")) return times * 3600; - if(_.includes(timeString, "day")) return times * 86400; - if(_.includes(timeString, "week")) return times * 604800; - if(_.includes(timeString, "month")) return times * 2592000; - if(_.includes(timeString, "year")) return times * 31536000; + if(_.includes(timeString, "hour")) return times * 3600; + if(_.includes(timeString, "day")) return times * 86400; + if(_.includes(timeString, "week")) return times * 604800; + if(_.includes(timeString, "month")) return times * 2592000; + if(_.includes(timeString, "year")) return times * 31536000; return Time.utc(); }, @@ -176,6 +180,7 @@ return { }; })(); +// The get variables used in the url var GetVars = (function(){ return { get: function(variable) { @@ -195,10 +200,6 @@ return { } return undefined; - }, - - set: function(variable, value) { - window.location.href = window.location.href.split("?")[0] + "?"+variable+"="+value; } }; })(); diff --git a/static/js/id.js b/static/js/id.js index ecf94f0..d7f33b0 100644 --- a/static/js/id.js +++ b/static/js/id.js @@ -1,3 +1,8 @@ // Change this to your own client ID: https://www.reddit.com/prefs/apps -// The app NEEDS TO BE an installed app and NOT a web apps -var clientID = ""; \ No newline at end of file +// Guide about it here: https://github.com/JubbeArt/removeddit#the-i-just-want-to-get-this-shit-running-guide +// NOTE: The app NEEDS TO BE an installed app and NOT a web apps +var clientID = ""; + +if(clientID === "") { + alert("Missing client-ID for Reddit API. See the file \"static/js/id.js\""); +} \ No newline at end of file