Skip to content

Commit

Permalink
Merge branch 'release/0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyvion committed Mar 30, 2017
2 parents e826759 + 618cbf9 commit 5df9507
Show file tree
Hide file tree
Showing 18 changed files with 377 additions and 53 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/dist
/nbproject/private
/node_modules
/.vagrant
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
language: node_js
node_js:
- "0.10"
- "4.5.0"
before_install:
- npm install -g grunt-cli
- gem install sass --version "=3.4.21"
- rvm install 2.4.1
- gem install sass --version "=3.4.23"
- gem install compass --version "=1.0.3"
install: npm install
install:
- npm update -g
- npm install
script: grunt build
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ module.exports = function (grunt) {
'assets/generated/setTitle.html': 'assets/templates/setTitle.html',
'assets/generated/setTagline.html': 'assets/templates/setTagline.html',
'assets/generated/donut.html': 'assets/templates/donut.html',
'assets/generated/itemDetails.html': 'assets/templates/itemDetails.html'
'assets/generated/itemDetails.html': 'assets/templates/itemDetails.html',
'assets/generated/comicNav.html': 'assets/templates/comicNav.html'
}
}
}
Expand Down
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
# Questionable Content Extensions User Script [![Build Status](https://travis-ci.org/Questionable-Content-Extensions/client.svg?branch=master)](https://travis-ci.org/Questionable-Content-Extensions/client) [![Dependency Status](https://www.versioneye.com/user/projects/56e06979df573d004c95f841/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56e06979df573d004c95f841) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com/)
# Questionable Content Extensions User Script [![Build Status](https://travis-ci.org/Questionable-Content-Extensions/client.svg?branch=master)](https://travis-ci.org/Questionable-Content-Extensions/client) [![Dependency Status](https://www.versioneye.com/user/projects/58da3f4f26a5bb0038e42095/badge.svg?style=flat)](https://www.versioneye.com/user/projects/58da3f4f26a5bb0038e42095) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com/)

## Getting Started

This project requires [Node.js®](https://nodejs.org/en/). Install it on your system in whatever manner is appropriate for your operating system, and then open a terminal and run the following commands after cloning this repository:
To build this project, you can make use of a [Vagrant virtual machine build environment](https://www.vagrantup.com/) which will take care of setting the build environment up for you (recommended) or, you can install the build environment on your own computer.

### Building using Vagrant

Install [Vagrant](https://www.vagrantup.com/) if you don't already have it on your system. (If you're not familiar with Vagrant from before, reading the [Getting Started](https://www.vagrantup.com/docs/getting-started/) documentation is recommended to get a feel for what it is about.)

Once Vagrant is installed, clone this repository, then run the following commands in the repository directory:

```shell
npm install -g grunt-cli # If you don't have grunt installed already
npm install # To get all the grunt plugins we use
vagrant up # To initialize the Vagrant virtual machine (this will take a while the first time)
vagrant ssh # To log into the virtual machine
grunt build # To build our script
```

After having ran the commands above, you should have files created at `dist\qc-ext.user.js` and `dist\qc-ext.min.user.js`. These files can be opened in Greasemonkey or Tampermonkey directly.
After having run the commands above, you should have files created at `dist\qc-ext.user.js` and `dist\qc-ext.min.user.js` within the repository. These files can be opened in Greasemonkey or Tampermonkey directly.

Whenever you've made changes and want to incorporate them into the user script, simply run `grunt build` in the Vagrant VM again.

When you're done developing, simply log off the virtual machine (`exit`) and run `vagrant suspend` or `vagrant halt`. To resume work later, just repeat the sequence of commands shown above. Should you want to remove the virtual machine, run `vagrant destroy`.

### Building on your own computer

This project requires [Node.js®](https://nodejs.org/) and [Ruby](https://www.ruby-lang.org/). Install them on your system in whatever manner is appropriate for your operating system, clone this repository, then run the following commands in the repository directory:

```shell
gem install compass # If you don't have compass installed already
npm install -g grunt-cli # If you don't have grunt installed already
npm install -g jsonlint # If you don't have jsonlint installed already
npm install -g jshint # If you don't have jshint installed already
npm install # To install all the grunt plugins we use
grunt build # To build our script
```

After having run the commands above, you should have files created at `dist\qc-ext.user.js` and `dist\qc-ext.min.user.js` within the repository. These files can be opened in Greasemonkey or Tampermonkey directly.

Whenever you've made changes and want to incorporate them into the user script, simply run `grunt build` again.

68 changes: 68 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "hashicorp/precise64"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.

# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", path: "provision.sh", privileged: false
end
1 change: 1 addition & 0 deletions assets/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var constants;

constants.itemDataUrl = constants.webServiceBaseUrl + 'itemdata/';
constants.itemFriendDataUrl = constants.itemDataUrl + 'friends/';
constants.itemLocationDataUrl = constants.itemDataUrl + 'locations/';
constants.setItemDataPropertyUrl = constants.itemDataUrl + 'setproperty';

constants.characterImageBaseUrl = constants.baseUrl + 'images/characters/';
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dom-operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var qcExt;
addCss(constants.baseUrl + 'style/bootstrap.min.css');

// Font Awesome
addCss('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/' +
addCss('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/' +
'font-awesome.min.css');

// Style adder function
Expand Down
39 changes: 23 additions & 16 deletions assets/js/qc-ext-comicService.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,22 @@ var qcExt;
return;
}

var comicData = response.data;
function fixItem(item) {
/* jshint eqeqeq:false */
if (item.first == self.comic) {
item.first = null;
}

if (item.last == self.comic) {
item.last = null;
}
/* jshint eqeqeq:true */

styleService.addItemStyle(item.id,
item.color);
}

var comicData = response.data;
if (comicData.hasData) {
if (comicData.next !== null) {
self.nextComic = comicData.next;
Expand All @@ -124,26 +138,19 @@ var qcExt;
self.comic - 1;
}

angular.forEach(comicData.items,
function(value) {
/* jshint eqeqeq:false */
if (value.first == self.comic) {
value.first = null;
}

if (value.last == self.comic) {
value.last = null;
}
/* jshint eqeqeq:true */

styleService.addItemStyle(value.id,
value.color);
});
angular.forEach(comicData.items, fixItem);
if (qcExt.settings.showAllMembers) {
angular.forEach(comicData.allItems, fixItem);
}
} else {
self.nextComic = self.comic + 1 > latestComic ?
latestComic : self.comic + 1;
self.previousComic = self.comic - 1 < 1 ? 1 :
self.comic - 1;

if (qcExt.settings.showAllMembers) {
angular.forEach(comicData.allItems, fixItem);
}
}

comicData.comic = self.comic;
Expand Down
66 changes: 66 additions & 0 deletions assets/js/qc-ext-qcComicNavDirective.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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('qcComicNav', function() {
return {
restrict: 'E',
replace: true,
scope: {},
controller: ['$log', 'comicService', 'latestComic', 'eventFactory',
'$scope',
function($log, comicService, latestComic, Event, $scope) {
$log.debug('START qcComicNav()');

var comicDataLoadedEvent =
new Event(constants.comicdataLoadedEvent);

this.currentComic = null;
this.latestComic = latestComic;
var self = this;

this.go = function() {
$log.debug('qcComicNav.go(): ' + self.currentComic);
if (self.currentComic === undefined ||
self.currentComic === null) {
self.currentComic = latestComic;
} else if (self.currentComic < 1) {
self.currentComic = 1;
} else if (self.currentComic > latestComic) {
self.currentComic = latestComic;
}
comicService.gotoComic(self.currentComic);
};

comicDataLoadedEvent.subscribe($scope,
function(event, comicData) {
self.currentComic = comicData.comic;
});

$log.debug('END qcComicNav()');
}],
controllerAs: 'cn',
template: qcExt.variables.angularTemplates.comicNav
};
});
})(qcExt || (qcExt = {}));
45 changes: 38 additions & 7 deletions assets/js/qc-ext-qcExtraDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var qcExt;
(function(qcExt) {
'use strict';

function Controller($scope, $log, comicService, latestComic, Event) {
function Controller($scope, $log, comicService, latestComic, Event, $sce) {
var comicDataLoadingEvent = new Event(constants.comicdataLoadingEvent);
var comicDataLoadedEvent = new Event(constants.comicdataLoadedEvent);
var comicDataErrorEvent = new Event(constants.comicdataErrorEvent);
Expand All @@ -45,13 +45,15 @@ var qcExt;
this.comicService = comicService;
this.settings = qcExt.settings;
this.items = {};
this.allItems = {};
this.editorData = {};
this.messages = [];
this.missingDataInfo = [];

function reset() {
self.isLoading = false;
self.items = {};
self.allItems = {};
self.editorData = {};
self.messages.length = 0;
self.missingDataInfo.length = 0;
Expand Down Expand Up @@ -119,12 +121,30 @@ var qcExt;
/* jscs:enable maximumLineLength */
/* jshint eqeqeq:true */
}

function processItem(item) {
if (!(item.type in self.items)) {
self.items[item.type] = [];
}
self.items[item.type].push(item);
}

function processAllItem(item) {
if (!(item.type in self.allItems)) {
self.allItems[item.type] = [];
}
self.allItems[item.type].push(item);
}

if (!comicData.hasData) {
self.messages.push(
'This strip has no navigation data yet'
);
self.hasWarning = true;

if (qcExt.settings.showAllMembers) {
angular.forEach(comicData.allItems, processAllItem);
}
return;
}

Expand All @@ -133,10 +153,7 @@ var qcExt;
var hasStoryline = false;
angular.forEach(comicData.items,
function(item) {
if (!(item.type in self.items)) {
self.items[item.type] = [];
}
self.items[item.type].push(item);
processItem(item);

if (item.type === 'cast') {
hasCast = true;
Expand All @@ -145,7 +162,11 @@ var qcExt;
} else if (item.type === 'storyline') {
hasStoryline = true;
}
});
}
);
if (qcExt.settings.showAllMembers) {
angular.forEach(comicData.allItems, processAllItem);
}

if (!hasCast) {
self.missingDataInfo.push('cast members');
Expand Down Expand Up @@ -184,6 +205,16 @@ var qcExt;
return 'Storylines';
case 'location':
return 'Locations';

case 'all-cast':
return $sce.trustAsHtml('Cast Members<br>' +
'<small>(Non-Present)</small>');
case 'all-storyline':
return $sce.trustAsHtml('Storylines<br>' +
'<small>(Non-Present)</small>');
case 'all-location':
return $sce.trustAsHtml('Locations<br>' +
'<small>(Non-Present)</small>');
}
};

Expand Down Expand Up @@ -212,7 +243,7 @@ var qcExt;
replace: true,
scope: {},
controller: ['$scope', '$log', 'comicService', 'latestComic',
'eventFactory', Controller],
'eventFactory', '$sce', Controller],
controllerAs: 'e',
template: qcExt.variables.angularTemplates.extra
};
Expand Down
Loading

0 comments on commit 5df9507

Please sign in to comment.