-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
804 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2016 Alexander Krivács Schrøder <[email protected]> | ||
* Copyright (C) 2016, 2017 Alexander Krivács Schrøder <[email protected]> | ||
* | ||
* 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 | ||
|
@@ -27,8 +27,8 @@ var constants; | |
|
||
// Set this to true when working against your local test server. | ||
// NEVER CHECK THIS FILE IN WITH developmentMode = true! | ||
var developmentMode = false; | ||
if (developmentMode) { | ||
constants.developmentMode = false; | ||
if (constants.developmentMode) { | ||
constants.baseUrl = | ||
'http://localhost/questionablecontentextensions/web/'; | ||
constants.webServiceBaseUrl = constants.baseUrl + 'app_dev.php/'; | ||
|
@@ -42,6 +42,7 @@ var constants; | |
constants.removeItemFromComicUrl = constants.comicDataUrl + 'removeitem'; | ||
constants.setComicTitleUrl = constants.comicDataUrl + 'settitle'; | ||
constants.setComicTaglineUrl = constants.comicDataUrl + 'settagline'; | ||
constants.setPublishDateUrl = constants.comicDataUrl + 'setpublishdate'; | ||
constants.setGuestComicUrl = constants.comicDataUrl + 'setguest'; | ||
constants.setNonCanonUrl = constants.comicDataUrl + 'setnoncanon'; | ||
|
||
|
@@ -59,4 +60,11 @@ var constants; | |
constants.comicdataLoadedEvent = 'comicdata-loaded'; | ||
constants.comicdataErrorEvent = 'comicdata-error'; | ||
constants.itemsChangedEvent = 'items-changed'; | ||
|
||
constants.messages = { | ||
maintenance: 'The Questionable Extensions' + | ||
' server is currently undergoing maintenance.' + | ||
' Normal operation should resume within a' + | ||
' few minutes.' | ||
}; | ||
})(constants || (constants = {})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2016 Alexander Krivács Schrøder <[email protected]> | ||
* Copyright (C) 2016, 2017 Alexander Krivács Schrøder <[email protected]> | ||
* | ||
* 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 | ||
|
@@ -22,10 +22,13 @@ var qcExt; | |
(function(qcExt) { | ||
'use strict'; | ||
|
||
// Add our modal windows | ||
$('body').prepend('<qc-settings></qc-settings>'); | ||
$('body').prepend('<qc-edit-comic-data></qc-edit-comic-data>'); | ||
$('body').prepend('<qc-item-details></qc-item-details>'); | ||
$('body').prepend('<qc-change-log></qc-change-log>'); | ||
|
||
// Take control over the page's title | ||
$('title').replaceWith('<title ng-controller="titleController as t">' + | ||
'{{t.title}}</title>'); | ||
|
||
|
@@ -85,6 +88,9 @@ var qcExt; | |
comicImg.attr('ng-click', 'c.next($event)'); | ||
comicImg.attr('on-error', 'c.comicService.canFallback() ' + | ||
'&& c.comicService.tryFallback()'); | ||
|
||
// #comicDirective.attr('id', 'comic-anchor'); | ||
comicDirective.append($('<qc-ribbon></qc-ribbon>')); | ||
|
||
var comicImage = comicImg.get(0); | ||
var comicLinkUrl = comicImage.src; | ||
|
@@ -110,6 +116,15 @@ var qcExt; | |
|
||
$('body #comicnav') | ||
.replaceWith('<qc-nav random-comic="randomComic"></qc-nav>'); | ||
|
||
if ($('#news, #newspost').prev().prop('tagName') === 'QC-NAV') { | ||
// There's no date section: Insert our own | ||
$('#news, #newspost').before('<qc-date></qc-date>'); | ||
} else { | ||
// There's a date section: Replace with our own | ||
$('#news, #newspost').prev().replaceWith('<qc-date></qc-date>'); | ||
} | ||
|
||
$('#news, #newspost').replaceWith('<qc-news></qc-news>'); | ||
|
||
// $('#side').prepend('<qc-extra></qc-extra>'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2016 Alexander Krivács Schrøder <[email protected]> | ||
* Copyright (C) 2016, 2017 Alexander Krivács Schrøder <[email protected]> | ||
* | ||
* 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 | ||
|
@@ -69,7 +69,12 @@ var qcExt; | |
}); | ||
|
||
function onErrorLog(response) { | ||
messageReportingService.reportError(response.data); | ||
if (response.status !== 503) { | ||
messageReportingService.reportError(response.data); | ||
} else { | ||
messageReportingService.reportError( | ||
constants.messages.maintenance); | ||
} | ||
return response; | ||
} | ||
|
||
|
@@ -103,8 +108,13 @@ var qcExt; | |
|
||
$http.get(comicDataUrl) | ||
.then(function(response) { | ||
if (response.status === 503) { | ||
comicDataErrorEvent.notify(response); | ||
return; | ||
} | ||
if (response.status !== 200) { | ||
onErrorLog(response); | ||
comicDataErrorEvent.notify(response); | ||
return; | ||
} | ||
|
||
|
@@ -158,7 +168,7 @@ var qcExt; | |
comicDataLoadedEvent.notify(self.comicData); | ||
}, function(errorResponse) { | ||
onErrorLog(errorResponse); | ||
comicDataErrorEvent.notify(errorResponse.data); | ||
comicDataErrorEvent.notify(errorResponse); | ||
}); | ||
}; | ||
|
||
|
@@ -211,6 +221,17 @@ var qcExt; | |
.then(onSuccessRefreshElseErrorLog, onErrorLog); | ||
}; | ||
|
||
this.setPublishDate = function(publishDate, isAccurate) { | ||
var data = { | ||
token: qcExt.settings.editModeToken, | ||
comic: self.comic, | ||
publishDate: publishDate, | ||
isAccuratePublishDate: isAccurate | ||
}; | ||
return $http.post(constants.setPublishDateUrl, data) | ||
.then(onSuccessRefreshElseErrorLog, onErrorLog); | ||
}; | ||
|
||
this.setGuestComic = function(value) { | ||
var data = { | ||
token: qcExt.settings.editModeToken, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (C) 2016, 2017 Alexander Krivács Schrøder <[email protected]> | ||
* | ||
* 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/>. | ||
*/ | ||
|
||
/* global constants */ | ||
|
||
var qcExt; | ||
|
||
(function(qcExt) { | ||
'use strict'; | ||
|
||
qcExt.app.directive('qcChangeLog', function() { | ||
return { | ||
restrict: 'E', | ||
replace: true, | ||
scope: {}, | ||
controller: ['$log', 'eventFactory', '$scope', | ||
function($log, Event, $scope) { | ||
$log.debug('START qcChangeLog()'); | ||
|
||
$log.debug(); | ||
|
||
this.versionUpdated = false; | ||
this.currentVersion = GM_info.script.version; | ||
this.previousVersion = null; | ||
var self = this; | ||
|
||
var comicDataLoadedEvent = | ||
new Event(constants.comicdataLoadedEvent); | ||
|
||
comicDataLoadedEvent.subscribe($scope, | ||
function() { | ||
if (qcExt.settings.version === undefined) { | ||
// Version is undefined. We're a new user! | ||
$log.debug('qcChangeLog(): Version undefined!'); | ||
} else if (qcExt.settings.version !== | ||
self.currentVersion) { | ||
// Version is changed. Script has been updated! | ||
// Show the change log dialog. | ||
self.previousVersion = qcExt.settings.version; | ||
$log.debug('qcChangeLog(): Version different!'); | ||
} else { | ||
return; | ||
} | ||
$('#changeLogDialog').modal('show'); | ||
self.versionUpdated = true; | ||
}); | ||
|
||
$('#changeLogDialog').on('hide.bs.modal', function() { | ||
$log.debug('Saving settings...'); | ||
qcExt.settings.version = self.currentVersion; | ||
GM_setValue(constants.settingsKey, | ||
JSON.stringify(qcExt.settings)); | ||
}); | ||
|
||
this.close = function() { | ||
$('#changeLogDialog').modal('hide'); | ||
}; | ||
|
||
$log.debug('END qcChangeLog()'); | ||
}], | ||
controllerAs: 'clvm', | ||
template: qcExt.variables.angularTemplates.changeLog | ||
}; | ||
}); | ||
})(qcExt || (qcExt = {})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.