Skip to content

Commit

Permalink
Merge branch 'release/0.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyvion committed Oct 3, 2018
2 parents 8f3b235 + 7e5795f commit d62569d
Show file tree
Hide file tree
Showing 17 changed files with 2,566 additions and 78 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/nbproject/private
/node_modules
/.vagrant
/.tmp

8 changes: 4 additions & 4 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@
"requireParamDescription": true,
"requireReturnDescription": true
}, */
"maximumLineLength": {
"value": 80,
/*"maximumLineLength": {
"value": 0,
"tabSize": 4,
"allExcept": [
"regex"
]
},
},*/
"requireAlignedMultilineParams": 0,
"requireAnonymousFunctions": {
"allExcept": [
Expand Down Expand Up @@ -146,7 +146,7 @@
},
"safeContextKeyword": ["self"],
"validateIndentation": "\t",
"validateLineBreaks": "LF",
"validateLineBreaks": null,
"validateParameterSeparator": ", ",
"validateQuoteMarks": "'"
}
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
4 changes: 3 additions & 1 deletion 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 Expand Up @@ -153,7 +154,8 @@ module.exports = function (grunt) {
'assets/generated/ribbon.html': 'assets/templates/ribbon.html',
'assets/generated/itemDetails.html': 'assets/templates/itemDetails.html',
'assets/generated/comicNav.html': 'assets/templates/comicNav.html',
'assets/generated/changeLog.html': 'assets/templates/changeLog.html'
'assets/generated/changeLog.html': 'assets/templates/changeLog.html',
'assets/generated/date.html': 'assets/templates/date.html'
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions assets/js/dom-operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ var qcExt;
}

if (qcExt.settings.showDebugLogs) {
console.debug('Running QC Extensions v' + GM_info.script.version);
console.debug('Latest URL:', latestUrl, 'Latest Comic:', latestComic);
}

Expand All @@ -127,8 +128,7 @@ var qcExt;

$('#news, #newspost').replaceWith('<qc-news></qc-news>');

// $('#side').prepend('<qc-extra></qc-extra>');
$('#container .small-2').prepend('<qc-extra></qc-extra>');
comicDirective.parent().siblings('.small-2').prepend('<qc-extra></qc-extra>');

// Set a base (required by Angular's html5Mode)
$('head').append('<base href="' + window.location.origin + '/">');
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);
};
}
1 change: 0 additions & 1 deletion assets/js/qc-ext-qcChangeLogDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ var qcExt;
} else {
return;
}
$('#changeLogDialog').modal('show');
self.versionUpdated = true;
});

Expand Down
70 changes: 9 additions & 61 deletions assets/js/qc-ext-qcDateDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,90 +47,38 @@ var qcExt;
this.$apply(fn);
}
};

function formatDate(dateTime) {
var monthNames = [
'January', 'February', 'March',
'April', 'May', 'June', 'July',
'August', 'September', 'October',
'November', 'December'
];

var weekDayNames = [
'Sunday', 'Monday', 'Tuesday',
'Wednesday', 'Thursday', 'Friday',
'Saturday'
];

var dayIndex = dateTime.getDay();
var date = dateTime.getDate();
var monthIndex = dateTime.getMonth();
var year = dateTime.getFullYear();

var dateText = weekDayNames[dayIndex] + ', ' +
monthNames[monthIndex] + ' ' + date + ', ' + year;

var hours = dateTime.getHours();
var minutes = dateTime.getMinutes();

if (minutes < 10) {
minutes = '0' + minutes;
}

var timeText;
if (qcExt.settings.useCorrectTimeFormat) {
if (hours < 10) {
hours = '0' + hours;
}
timeText = hours + ':' + minutes;
} else {
var meridiem;
if (hours < 12) {
meridiem = 'a.m.';
} else {
meridiem = 'p.m.';
}
hours = hours % 12;
if (hours === 0) {
hours = 12;
}

timeText = hours + ':' + minutes + ' ' + meridiem;
}

return dateText + ' ' + timeText;
}

var self = this;
this.date = '';
this.settings = qcExt.settings;
this.date = null;
this.approximateDate = false;
comicDataLoadingEvent.subscribe($scope,
function() {
$scope.safeApply(function() {
self.date = '';
self.date = null;
self.approximateDate = false;
});
});
comicDataLoadedEvent.subscribe($scope,
function(event, comicData) {
$scope.safeApply(function() {
self.approximateDate = !comicData.isAccuratePublishDate;
var publishDate = comicData.publishDate;
$log.debug('qcDate(): ', publishDate);
if (publishDate !== null &&
publishDate !== undefined) {
var date = new Date(publishDate);
self.date = formatDate(date);
if (!comicData.isAccuratePublishDate) {
self.date += ' (Approximately)';
}
self.date = date;
} else {
self.date = '';
self.date = null;
}
});
});

$log.debug('END qcDate()');
}],
controllerAs: 'd',
template: '<div class="row"><b>{{d.date}}</b></div>'
template: qcExt.variables.angularTemplates.date
};
});
})(qcExt || (qcExt = {}));
16 changes: 16 additions & 0 deletions assets/js/qc-ext-qcExtraDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ var qcExt;
comicService.comic > constants.taglineThreshold) {
self.missingDataInfo.push('a tagline');
}

if (qcExt.settings.version === undefined) {
// Version is undefined. We're a new user!
$log.debug('qcExtra(): Version undefined!');
self.showWelcomeMessage = true;
} else if (qcExt.settings.version !==
self.currentVersion) {
// Version is changed. Script has been updated!
$log.debug('qcExtra(): Version different!');
self.showUpdateMessage = true;
}
});
});

Expand Down Expand Up @@ -239,6 +250,11 @@ var qcExt;
$log.debug(item);
};

this.showChangeLog = function() {
self.showWelcomeMessage = false;
self.showUpdateMessage = false;
$('#changeLogDialog').modal('show');
};
}

qcExt.app.directive('qcExtra', function() {
Expand Down
2 changes: 0 additions & 2 deletions assets/js/qc-ext-qcSettingsDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ var qcExt;
return self.settings.showAllMembers;
}, function() {
return self.settings.editMode;
}, function() {
return self.settings.useCorrectTimeFormat;
}], function() {
comicService.refreshComicData();
});
Expand Down
10 changes: 9 additions & 1 deletion assets/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ $link-color: #2ba6cb;
margin-top: 10px;

&.first-header {
margin-top: 0px;
margin-top: 0;
}

&.update-header {
margin-top: 0;
margin-bottom: 0;

color: #e43;
font-weight: bold;
}

small {
Expand Down
16 changes: 15 additions & 1 deletion assets/templates/changeLog.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,21 @@ <h4>Script updated!</h4>
<div ng-if="!clvm.previousVersion">
<h4>Script installed!</h4>
<p>Thank you for installing Questionable Content Extensions!</p>
</div>
</div>

<!--
<h4>NextVersion <small>NextDate</small></h4>
<ul>
<li></li>
</ul>
-->

<h4>0.5.2 <small>October 3, 2018</small></h4>
<ul>
<li>Use Angular's date formatting for a better user experience</li>
<li>Don't throw change log in user's face on update or fresh installation, instead show small notice</li>
</ul>

<h4>0.5.1 <small>April 8, 2017</small></h4>
<ul>
<li>Deal better with server errors and maintenance</li>
Expand Down
23 changes: 23 additions & 0 deletions assets/templates/date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
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/>.
-->
<div class="row">
<b>
<span ng-if="d.settings.useCorrectTimeFormat">{{d.date | date:'EEEE, MMMM d, yyyy HH:mm' }}</span>
<span ng-if="!d.settings.useCorrectTimeFormat">{{d.date | date:'EEEE, MMMM d, yyyy h:mm a' }}</span>
<span ng-if="d.approximateDate"> (Approximately)</span>
</b>
</div>
12 changes: 12 additions & 0 deletions assets/templates/extra.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
<tr ng-repeat="message in e.messages">
<td>{{ message }}</td>
</tr>
<tr ng-if="e.showWelcomeMessage">
<td>
<h1 class="update-header">Welcome to QC&nbsp;Extensions!</h1>
<a class="qc" ng-click="e.showChangeLog()">See change log!</a>
</td>
</tr>
<tr ng-if="e.showUpdateMessage">
<td>
<h1 class="update-header">QC Extensions updated!</h1>
<a class="qc" ng-click="e.showChangeLog()">See what's new!</a>
</td>
</tr>
<tr ng-if="e.settings.editMode && e.editorData.missing.any">
<td>
<h1 class="first-header">Comics with missing items</h1>
Expand Down
Loading

0 comments on commit d62569d

Please sign in to comment.