Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"GM_xmlhttpRequest": true,
"GM_getValue": true,
"GM_setValue": true,
"unsafeWindow": true
"unsafeWindow": true,
"GM": true
},
"latedef": true,
"nocomma": true,
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "4.5.0"
- "4.7.0"
before_install:
- npm install -g grunt-cli
- rvm install 2.4.1
Expand Down
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ module.exports = function (grunt) {
banner: '<%= pkg.licenseBanner %>\n<%= pkg.userscriptBanner %>'
},
src: [
'assets/js/gm4-shim.js',
'assets/js/constants.js',
'assets/generated/variables.pass2.js',
'assets/js/settings.js',
Expand Down
61 changes: 61 additions & 0 deletions assets/js/gm4-shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Functions copied from https://gist.github.com/arantius/3123124
The MIT License (MIT)

Copyright (c) 2014 Anthony Lieuallen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
*/

/*jshint unused:false, esversion: 6, latedef: false*/

if (typeof GM !== 'undefined' && typeof GM_getValue === 'undefined') {
if (typeof GM_info === 'undefined') { const GM_info = GM.info; }
var GM_xmlhttpRequest = GM.xmlHttpRequest;
var storagePrefix = GM.info.script.name.replace(/[^A-Z]*/g, '') + '-';

// The following functions all use local storage, and thus could be accessed
// by the host. They are also restricted to a single domain.

var GM_deleteValue = function(aKey) {
'use strict';

localStorage.removeItem(storagePrefix + aKey);
};

var GM_getValue = function(aKey, aDefault) {
'use strict';

var aValue = localStorage.getItem(storagePrefix + aKey);
if (null === aValue && 'undefined' !== typeof aDefault) { return aDefault; }
return aValue;
};

var GM_listValues = function() {
'use strict';

var prefixLen = storagePrefix.length;
var values = [];
for (var i = 0; i < localStorage.length; i++) {
var k = localStorage.key(i);
if (k.substr(0, prefixLen) === storagePrefix) {
values.push(k.substr(prefixLen));
}
}
return values;
};

var GM_setValue = function(aKey, aVal) {
'use strict';

localStorage.setItem(storagePrefix + aKey, aVal);
};
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "questionable-content-spa",
"version": "0.5.1",
"version": "0.5.2",
"author": "Alexander Krivács Schrøder",
"devDependencies": {
"grunt": "~1.0.1",
Expand All @@ -15,5 +15,5 @@
"load-grunt-tasks": "~3.5"
},
"licenseBanner": "/* \n * Copyright (C) 2016 Alexander Krivács Schrøder <alexschrod@gmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n",
"userscriptBanner": "// ==UserScript==\n// @name Questionable Content Single-Page Application with Extra Features\n// @namespace https://questionablextensions.net/\n// @version <%= pkg.version %>\n// @author Alexander Krivács Schrøder\n// @description Converts questionablecontent.net into a single-page application and adds extra features, such as character, location and storyline navigation.\n// @homepage https://questionablextensions.net/\n// @icon https://questionablextensions.net/images/icon.png\n// @icon64 https://questionablextensions.net/images/icon64.png\n// @updateURL https://questionablextensions.net/releases/qc-ext.latest.meta.js\n// @downloadURL https://questionablextensions.net/releases/qc-ext.latest.user.js\n// @supportURL https://github.com/Questionable-Content-Extensions/client/issues\n// @match *://*.questionablecontent.net/\n// @match *://*.questionablecontent.net/index.php\n// @match *://*.questionablecontent.net/view.php*\n// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.js\n// @require https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js\n// @require https://questionablextensions.net/scripts/angular.custom.js\n// @require https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.18/angular-ui-router.min.js\n// @connect questionablextensions.net\n// @connect localhost\n// @grant GM_getValue\n// @grant GM_setValue\n// @grant GM_xmlhttpRequest\n// @noframes\n// ==/UserScript==\n"
"userscriptBanner": "// ==UserScript==\n// @name Questionable Content Single-Page Application with Extra Features\n// @namespace https://questionablextensions.net/\n// @version <%= pkg.version %>\n// @author Alexander Krivács Schrøder\n// @description Converts questionablecontent.net into a single-page application and adds extra features, such as character, location and storyline navigation.\n// @homepage https://questionablextensions.net/\n// @icon https://questionablextensions.net/images/icon.png\n// @icon64 https://questionablextensions.net/images/icon64.png\n// @updateURL https://questionablextensions.net/releases/qc-ext.latest.meta.js\n// @downloadURL https://questionablextensions.net/releases/qc-ext.latest.user.js\n// @supportURL https://github.com/Questionable-Content-Extensions/client/issues\n// @match *://*.questionablecontent.net/\n// @match *://*.questionablecontent.net/index.php\n// @match *://*.questionablecontent.net/view.php*\n// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.js\n// @require https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js\n// @require https://questionablextensions.net/scripts/angular.custom.js\n// @require https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.18/angular-ui-router.min.js\n// @connect questionablextensions.net\n// @connect localhost\n// @grant GM_getValue\n// @grant GM_setValue\n// @grant GM_xmlhttpRequest\n// @grant GM.xmlHttpRequest\n// @noframes\n// ==/UserScript==\n"
}