Skip to content

Instantly share code, notes, and snippets.

@nuved
Last active September 1, 2015 20:04
Show Gist options
  • Save nuved/8b5c676a7498da0e9d0d to your computer and use it in GitHub Desktop.
Save nuved/8b5c676a7498da0e9d0d to your computer and use it in GitHub Desktop.
Show Movies information from IMDB
// ==UserScript==
// @encoding UTF-8
// @name Pardis_Gholhak
// @description Show Movies information from IMDB
// @namespace http://novid.ir
// @include http://wwww.pardis-gholhak.com/teque/*
// @include http://pardis-gholhak.com/teque/*
// @version 1
// ==/UserScript==
(function() {
'use strict';
setTimeout(function () {
Array.prototype.forEach.call(document.querySelectorAll('h2 > a, a.cinema-movie-title'), function (element) {
var title = element.textContent;
fetch("http://www.imdbapi.com/?t=" + title).then(function (res) {
return res.text();
}).then(function(body) {
var data = JSON.parse(body);
if (data.Year) {
element.innerHTML = element.innerHTML + ' <bdi style="font-family: serif">(' + data.Year + ')(' + data.imdbRating + ')('
+ data.Awards + ')(' + data.Runtime + ')(' + data.Genre + ')</bdi> <bdi><a style="color: blue"'
+ 'href="http://www.imdb.com/title/' + data.imdbID + '/">(IMDb)</a></bdi>';
}
}).then(undefined, function (e) { console.error(e); });
});
}, 3000);
}());
@mmirzaee
Copy link

mmirzaee commented Sep 1, 2015

Thank you man.
We're redesigning Pardis's website and we'll use it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment