Skip to content

Commit

Permalink
Userscript updated for MovieMeter.nl and Whiwa.net.
Browse files Browse the repository at this point in the history
Thanks to Mars and/or Jaco!
  • Loading branch information
RuudBurger committed Dec 31, 2010
1 parent 6dd839e commit ac5581b
Showing 1 changed file with 75 additions and 4 deletions.
79 changes: 75 additions & 4 deletions app/views/config/userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
// @include http*://*.imdb.com/title/tt*
// @include http*://imdb.com/title/tt*
// @include ${host}*
// @include http://*.sharethe.tv/movies/*
// @include http://sharethe.tv/movies/*
// @include http://*.sharethe.tv/movies/*
// @include http://sharethe.tv/movies/*
// @include http://*.moviemeter.nl/film/*
// @include http://moviemeter.nl/film/*
// @include http://whiwa.net/stats/movie/*
// ==/UserScript==

var version = 2;
var version = 3;

function create() {
switch (arguments.length) {
Expand Down Expand Up @@ -168,11 +171,79 @@ sharethetv = (function(){
return constructor;
})();

moviemeter = (function(){

function isMovie(){
var pattern = /[^/]+\/?$/;
var html = document.getElementsByTagName('h1')[0].innerHTML
matched = location.href.match(pattern);
return null != matched;
}

function getId(){
var pattern = /imdb\.com\/title\/tt(\d+)/;
var html = document.getElementsByTagName('html')[0].innerHTML;
var imdb_id = html.match(pattern)[1];
return imdb_id;

}

function getYear(){
var pattern = /(\d+)[^\d]*$/;
var html = document.getElementsByTagName('h1')[0].innerHTML;
var year = html.match(pattern)[1];
return year;

}

function constructor(){
if(isMovie()){
lib.osd(getId(), getYear());
}
}
return constructor;
})();

whiwa = (function(){

function isMovie(){
var pattern = /[^/]+\/?$/;
var html = document.getElementsByTagName('h3')[0].innerHTML
matched = location.href.match(pattern);
return null != matched;
}

function getId(){
var pattern = /imdb\.com\/title\/tt(\d+)/;
var html = document.getElementsByTagName('html')[0].innerHTML;
var imdb_id = html.match(pattern)[1];
return imdb_id;

}

function getYear(){
var pattern = /(\d+)[^\d]*$/;
var html = document.getElementsByTagName('h3')[0].innerHTML;
var year = html.match(pattern)[1];
return year;

}

function constructor(){
if(isMovie()){
lib.osd(getId(), getYear());
}
}
return constructor;
})();

// Start
(function(){
factory = {
"imdb.com" : imdb,
"sharethe.tv" : sharethetv
"sharethe.tv" : sharethetv,
"moviemeter.nl" : moviemeter,
"whiwa.net" : whiwa
};
for (var i in factory){
GM_log(i);
Expand Down

0 comments on commit ac5581b

Please sign in to comment.