aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--matanico.js36
-rw-r--r--nicontroller.js12
-rw-r--r--nnp_cooperation.js4
3 files changed, 24 insertions, 28 deletions
diff --git a/matanico.js b/matanico.js
index 91b1e4d..6bdd4c6 100644
--- a/matanico.js
+++ b/matanico.js
@@ -80,23 +80,23 @@
* 2008/09/04 v0.60 add function to post related tag page
* */
-(function(){
+(function() {
// information functions
// change XPath query when html changed.
-function NicoScraper(){}
+function NicoScraper() {}
NicoScraper.prototype = {
constants: {
- VERSION: '0.50',
- WATCH_PAGE: 1,
- WATCH_URL: '^http://www\.nicovideo\.jp/watch/[a-z][a-z]\\d+',
- TAG_PAGE: 2,
- TAG_URL: '^http://www\.nicovideo\.jp/tag/',
- RELATED_TAG_PAGE: 3,
- RELATED_TAG_URL: '^http://www\.nicovideo\.jp/related_tag/',
+ VERSION: '0.50',
+ WATCH_PAGE: 1,
+ WATCH_URL: '^http://www\\.nicovideo\\.jp/watch/[a-z]{2}\\d+',
+ TAG_PAGE: 2,
+ TAG_URL: '^http://www\\.nicovideo\\.jp/tag/',
+ RELATED_TAG_PAGE: 3,
+ RELATED_TAG_URL: '^http://www\\.nicovideo\\.jp/related_tag/',
},
- version: function(){ return this.constants.VERSION; },
+ version: function() { return this.constants.VERSION; },
pagecheck: function() {
if(this.getURL().match(this.constants.WATCH_URL)) return this.constants.WATCH_PAGE;
@@ -115,9 +115,7 @@ NicoScraper.prototype = {
return null;
},
- getURL: function() {
- return liberator.buffer.URL;
- },
+ getURL: function() { return liberator.buffer.URL; },
getSubject: function() {
if(this.pagecheck() === this.constants.WATCH_PAGE) {
@@ -258,7 +256,7 @@ liberator.commands.addUserCommand(['matanico'], "update Twitter's status to curr
if(req) {
req.open('POST', postURL, true, user, pass);
req.onreadystatechange = function() {
- if (req.readyState == 4) {
+ if(req.readyState == 4) {
if(req.status == 200) liberator.echo('Posted ' + post_string)
else throw 'failure in posting status to Twitter. HTTP status code : ' + req.status;
}
@@ -306,12 +304,12 @@ function $s(query, node) {
// user account manager
// from direct_bookmark.js
// thanks to Trapezoid
-function getUserAccount(form,post,arg){
+function getUserAccount(form,post,arg) {
var user, password;
- try{
+ try {
var passwordManager = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
var logins = passwordManager.findLogins({}, form, post, arg);
- if(logins.length > 0){
+ if(logins.length > 0) {
[user, password] = [logins[0].username, logins[0].password];
} else {
var promptUser = { value : '' }, promptPass = { value : '' };
@@ -326,7 +324,7 @@ function getUserAccount(form,post,arg){
window, form, 'Enter e-mail address and password.',
promptUser, promptPass, null, {}
);
- if(ret){
+ if(ret) {
[user, password] = [promptUser.value, promptPass.value];
var formLoginInfo = new nsLoginInfo(form,
post, null,
@@ -337,7 +335,7 @@ function getUserAccount(form,post,arg){
}
}
}
- catch(ex){
+ catch(ex) {
liberator.echoerr("handled exception during getting username and password");
liberator.log(ex);
}
diff --git a/nicontroller.js b/nicontroller.js
index 283d433..3923e3d 100644
--- a/nicontroller.js
+++ b/nicontroller.js
@@ -103,8 +103,8 @@ function NicoPlayerController(){}
NicoPlayerController.prototype = {
constants: {
VERSION: '0.41',
- WATCH_URL: '^http://www\.nicovideo\.jp/watch/[a-z][a-z]\\d+',
- TAG_URL: '^http://www\.nicovideo\.jp/tag/',
+ WATCH_URL: '^http://www\\.nicovideo\\.jp/watch/[a-z]{2}\\d+',
+ TAG_URL: '^http://www\\.nicovideo\\.jp/tag/',
WATCH_PAGE: 1,
TAG_PAGE: 2,
COMMAND_NORMAL: [
@@ -147,9 +147,7 @@ NicoPlayerController.prototype = {
throw 'current tab is not nicovideo.jp';
},
- getURL: function() {
- return liberator.buffer.URL;
- },
+ getURL: function() { return liberator.buffer.URL; },
_flvplayer: function() {
if(this.pagecheck() === this.constants.WATCH_PAGE) {
@@ -450,7 +448,7 @@ function expandExCommand(arg) {
}
// ex_command is putted in braces
- if(comment.match(/^\{([^\}]+)\}(.+)/)) {
+ if(comment.match(/^\{([^{}]+)\}(.+)/)) {
var exCommand = RegExp.$1;
var text = RegExp.$2;
@@ -511,7 +509,7 @@ function analysisExCommand(exCommand) {
// line
if(exCommand.match(/\bline(-?\d+)\b/)) {
var line = parseInt(RegExp.$1, 10);
- if(line < 0) line = properties.max + line + 1;
+ if(line < 0) line = properties.max + line + 1;
if(line > properties.max) line = properties.max;
properties.line = line;
}
diff --git a/nnp_cooperation.js b/nnp_cooperation.js
index 1334230..832bc02 100644
--- a/nnp_cooperation.js
+++ b/nnp_cooperation.js
@@ -85,7 +85,7 @@ const thumbnailURL = 'http://tn-skr1.smilevideo.jp/smile?i=';
// style
const styles = [
- '<style>',
+ '<style type="text/css">',
'table.nnp_coop .index { text-align:right; width:2em; }',
'table.nnp_coop .thumbnail { text-align:center; }',
'table.nnp_coop caption { color:green; }',
@@ -121,7 +121,7 @@ const thead = [
const itemHTML = [
'<tr>',
'<td class="index">$INDEX:</td>',
- '<td class="thumbnail"><image src="$THUMBNAILURL$ID" width="33" height="25" /></td>',
+ '<td class="thumbnail"><image src="$THUMBNAILURL$ID" width="33" height="25"/></td>',
'<td>$TITLE</td>',
'<td>$URL</td>',
'</tr>',