Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
Move settings from themeScript.js into its own file
Browse files Browse the repository at this point in the history
Default settings.js still included in release zips.
  • Loading branch information
scooterpsu committed Mar 17, 2019
1 parent 03b975f commit 7008ae8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 61 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

comixology2/settings.js
101 changes: 40 additions & 61 deletions comixology2/themeScript.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
/* Settings */
var defaultUsername="ComicFan"; /* This is the username that shows when Ubooquity isn't set to use accounts. */
var defaultSearch="comics"; /* Set to "comics" or "books". Only applies to pages outside of /comics/ or /books/ (homepage, files, mobile, my books). */
var comicsBaseID=null; /* Set to null to disable publisher page. */
var featuredPublishers=["DC Comics","Marvel","Image","IDW Publishing","Dark Horse Comics", "Vertigo"]; /* set to null to disable Featured publisher list */
var booksBaseID=null; /* Set to null to disable author page. */
var storyArcID=null; /* Set to null to disable story arc functions. */
var seriesID=null; /* Set to null to disable series functions. */
var homepageIssues=30; /* Number of issues to display in homepage sliders (in Latest/Random Comics/Books). */
var maxPages=20; /* Maximum number of pages to look for items (ie. Featured publishers), 20 should be plenty for most cases */
var showRandom=true; /* Show Random Comics/Random Books sliders on homepage. */
var registerLink=false; /* Include register link on login form (currently broken since there's no method for import, leave disabled).*/
var hideCoverList=true; /* Remove table of alternate covers from comic descriptions. */
var weirdIssueNumbers=["001.MU","034.DC"]; /* Weird comic numbering cases too weird to parse automatically. */
var bookmarkConfirm=false; /* Popup an alert when you bookmark something. */
var showBookCount = false; /* Show number of books/issues in folder subtitle. */
var showComicIssueTitle = false; /* Show issue title on comic details page. */
var hideSocialLinks = false; /* Hide non-functional social share bar on book details and series/arc pages. */
var useSimpleArcTemplate = true; /* Use more Comixology-like template for series/story arc pages (doesn't have bookmark button). */
var audiobookShare=null /* Name of share in Files is used for audiobooks. Set to null (not "null") to disable. */
var autoPlayAudiobooks = false; /* Automatically start playing the first track of an audiobook when loaded. */

/* Ubooquity settings not available in API (Set these to match your Ubooquity settings manually) */
var bookmarkUsingCookies=false; /* Store bookmarks in cookies instead of the server */
var displayTitleInsteadOfFileName=false; /* Display title from metadata instead of file name */

/* Saving Ubooquity preferences to sessionStorage, do not edit below. */
if(sessionStorage.getItem("settings") === null){
var currentPath = window.location.href;
Expand All @@ -49,6 +23,9 @@ var itemsPerPage = settingsJSON['comicsPaginationNumber'];
var Bookmarks = [];
var bookmarkLocation = "Ubooquity_Bookmarks2";

/* Load theme settings from settings.js before doing anything else. */
loadScript(proxyPrefix+"/theme/settings.js", function(){

/* Load JQuery and JQuery UI, then rebuild pages. */
loadScript(proxyPrefix+"/theme/js/jquery-3.3.1.min.js", function(){
loadScript(proxyPrefix+"/theme/js/jquery-ui.min.js", function(){
Expand Down Expand Up @@ -1412,41 +1389,6 @@ function importUser(string){
document.getElementById('editform').submit();
}

/* What makes this all possible. */
function loadScript(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
callback();
}
};
}else{ //Others
script.onload = function(){
callback();
};
}
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
}

/* Cookie functions (for loading settings). */
function getPage(url) {
var resp;
var xmlHttp;
resp = '';
xmlHttp = new XMLHttpRequest();
if(xmlHttp != null){
xmlHttp.open( "GET", url, false );
xmlHttp.send( null );
resp = xmlHttp.responseText;
}
return resp ;
}

/* Book popup rebuild */
function rebuildBookDetails(rootPath, xmlhttp, whichPage){
$(whichPage).append('<a id="details_close" href="#" onclick="showHidePopupMenu(\''+whichPage.split('#')[1]+'\',\'searchbox\',\'pageselector\',\'settingsbox\');return false;">×</a>');
Expand Down Expand Up @@ -1595,4 +1537,41 @@ function getDetails(itemId, rootPath, target){
}
xmlhttp.open("GET", rootPath + target+"/" + itemId ,true);
xmlhttp.send();
}

});

/* What makes this all possible. */
function loadScript(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
callback();
}
};
}else{ //Others
script.onload = function(){
callback();
};
}
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
}

/* Cookie functions (for loading settings). */
function getPage(url) {
var resp;
var xmlHttp;
resp = '';
xmlHttp = new XMLHttpRequest();
if(xmlHttp != null){
xmlHttp.open( "GET", url, false );
xmlHttp.send( null );
resp = xmlHttp.responseText;
}
return resp ;
}

0 comments on commit 7008ae8

Please sign in to comment.