מדיה ויקי:Common.js/externalsmaker.js – הבדלי גרסאות

Amire80 (שיחה | תרומות)
אין תקציר עריכה
הוספת תמיכה באתרים שבוקשו בחב"דפדיה:פיתוח התשתית, חלק מהתבניות לא קיימות עדיין
שורה 1: שורה 1:
/*Author:[[user:שמוליק]] with a lot of help from [[user:קיפודנחש]] */
function wikiit() {
function wikiit() {


שורה 70: שורה 69:
     /* http://james.padolsey.com/javascript/bujs-1-getparameterbyname/ */
     /* http://james.padolsey.com/javascript/bujs-1-getparameterbyname/ */
     var match = RegExp('[?&]' + name + '=([^&]*)')
     var match = RegExp('[?&]' + name + '=([^&]*)')
                     .exec(window.location.search);
                     .exec(window.location.href);
     return match && decodeURIComponent(match[1].replace(/\+/gi, ' '));
     return match && decodeURIComponent(match[1].replace(/\+/gi, ' '));
   }
   }
שורה 79: שורה 78:
params: [
params: [
{ str: 'קישור חבד אינפו' },
{ str: 'קישור חבד אינפו' },
{
{ urlparam: 'id' },
str: location.href,
{ telem: 'div.art_title' },
match: /www.chabad.info\/#!g=1&url=article&id=(\d+)/
{ telem: 'div.art_author' },
},
{ telem: 'div.art_time_id', match:/(\d+\.\d+\.\d+)/, split:'.', func:dateFormat}
//[
]
{ telem: 'div.art_title' }
},
//]
{
hostname: 'www.chabad.co.il',
params: [
{ str: 'קישור חבד בישראל' },
{ urlparam: 'topic' },
{ urlparam: 'article' },
{ telem: 'div.art_title' },
{ telem: 'div.art_author' },
{ telem: 'div.art_date', match:/(\d+\.\d+\.\d+)/, split:'.', func:dateFormat }
]
]
},
},
שורה 92: שורה 99:
params: [
params: [
{ str: 'קישור הגאולה' },
{ str: 'קישור הגאולה' },
{
{ str:  location.href, match: /hageula.com\/news\/([^/]+)\/\d+.html/ },
str:  location.href,
{ str:  location.href, match: /hageula.com\/news\/[^/]+\/(\d+).html/ },
match: /hageula.com\/news\/([^/]+)\/\d+.html/
{ telem: 'h1:first' },
},
{ elem: ['a[href^="/author"]', 'parent', 'text']},
{
{ telem: 'table.Aborder tr:first td:last div', split:'.', func:dateFormat}
str:  location.href,
match: /hageula.com\/news\/[^/]+\/(\d+).html/
},
//[
{ telem: 'h1:first' }
//]
]
]
},
},
שורה 109: שורה 110:
params: [
params: [
{ str: 'קישור חבד און ליין' },
{ str: 'קישור חבד און ליין' },
{
[
str: location.href,
          { urlparam: 'artID'},
match: /col.org.il\/show_news.rtx\?artID=(\d+)/
          { str:location.href, match:/_(\d+)\.html?$/}
},
        ],
//[
{ telem: 'table:eq(6) div:first' },
{ telem: 'table:nth-of-type(5) div:first' }
{ str: '' }, //author
//]
{ telem: 'table:eq(6) div:eq(1)', match:/\(יום .+, (.*?)\)/ }
]
},
{
hostname: 'www.shturem.net',
params: [
{ str: 'קישור שטורעם' },
{ urlparam:'section' },
{ urlparam:'id' },
{ telem: 'artTitle' },
{ telem: 'artReporter' },
{ telem: 'artDate' }
]
},
{
hostname: 'www.chabad.org.il', hrefmatch:/Magazines/,
params: [
{ str: 'קישור התקשרות צאח' },
{ urlparam: 'CategoryID' },
{ urlparam: 'ArticleID' },
{ telem: "a.navigationTab:contains('התקשרות')" , match:/(\d+)/ },
{ telem: "CategoryTitle" },
{ telem: '.bodyinsmall' , match:/מאת:?(.*?)\n/ },
]
]
},
},
{
{
hostname: 'www.chabad.co.il',
      hostname: "www.scribd.com",
      params: [
        { str: 'קישור בית משיח'},
        { func: function(){return $(".pager input").val()+1;} },
        { telem: "h1.book_title"},
        { func: function(){return prompt("שם כתב")}},
        { func: function(){return prompt("כותרת כתבה")}}
      ]
},
{
hostname: /otzar770.com/,
params: [
params: [
{ str: 'קישור חבד בישראל' },
{ str: 'קישור אוצר 770' },
{
[
str: location.href,
          { urlparam:"nBookId"},
match: /www.chabad.co.il\/\?template=article&topic=(\d+)&article=\d+/
          { str:'', func: function(_){return $($($("frame[name='site']")[0].contentWindow.document)
},
                                .find("frame[name='main']")[0].contentWindow.document)
{
                                .find("iframe#mainArea").contents().get(0).location.href.match(/nBookId=(\d+)/)[1]}
str: location.href,
          }
match: /www.chabad.co.il\/\?template=article&topic=\d+&article=(\d+)/
        ]
},
        [
//[
          { urlparam:"nPageNumber"},
{ telem: 'div.art_title' }
          { str:'', func: function(_){return $($($($("frame[name='site']")[0].contentWindow.document)
//]
                                .find("frame[name='main']")[0].contentWindow.document)
                                .find("iframe#mainArea").contents()
                                .find("frame[name='navFrame']")[0]
                                .contentWindow.document).find("input[name=nCurrentPage]").val()}}
        ],
{str:'', func: function(_){
                              var main = $("frame[name='site']").length ?
                                $($($("frame[name='site']")[0].contentWindow.document).find("frame[name='main']")[0].contentWindow.document):
                                document;
                              var title = $($(main)
                              .find("iframe#mainArea").contents()
                              .find("frame[name='navFrame']")[0]
                              .contentWindow.document).find("#titleSpan").text();
                              rm = ["(מוגה)","(בלתי מוגה)", /^מאמרים/g, "ספרים שונים", "(Edited)","(Unedited)"];
                              for (x in rm) title = title.trim().replace(rm[x],'');
                              return title},
        },
        {func:function(_){return prompt("האדמו\"ר מחבר הספר?");}}
]
]
}
},
];
];


שורה 272: שורה 322:
s.setAttribute('src',"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
s.setAttribute('src',"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
s.onload=wikiit;
s.onload=wikiit;
document.getElementsByTagName('body')[0].appendChild(s);
try {
document.getElementsByTagName('body')[0].appendChild(s);
}
catch (e) {
document.getElementsByTagName('head')[0].appendChild(s);
}
})();
})();