diff --git a/translators/Paris Review.js b/translators/Paris Review.js new file mode 100644 index 0000000000..9a901b458c --- /dev/null +++ b/translators/Paris Review.js @@ -0,0 +1,116 @@ +{ + "translatorID":"b24ee183-58a6-443d-b8f9-c5cd5a3a0f73", + "label":"Paris Review", + "creator":"Avram Lyon", + "target":"^http://www\\.theparisreview\\.org/", + "minVersion":"1.0", + "maxVersion":"", + "priority":100, + "inRepository":true, + "translatorType":4, + "lastUpdated":"2010-10-31 21:49:18" +} + +/* + Paris Review Translator + Copyright (C) 2010 Avram Lyon, ajlyon@gmail.com + + 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 . +*/ + +function detectWeb(doc, url){ + if (url.match(/\/(interviews|poetry|fiction|letters-essays)\/\d+\//)) { + return "magazineArticle"; + } else if (url.match(/\/blog\/\d+\//)) { + return "blogPost"; + } else if (url.match(/\/(blog|interviews|current-issue|letters-essays|poetry|fiction)($|\/)/)|| url.match(/\/search\?/) ){ + return "multiple"; + } else return false; +} + +function doWeb(doc, url){ + var n = doc.documentElement.namespaceURI; + var ns = n ? function(prefix) { + if (prefix == 'x') return n; else return null; + } : null; + + var articles = new Array(); + if (detectWeb(doc, url) == "multiple") { + var items = new Array(); + + var aTags = doc.getElementsByTagName("a"); + for(var i=0; i