35,369
רעדאגירונגען
אין תקציר עריכה |
(אנדערע שפראכן..) |
||
| שורה 8: | שורה 8: | ||
"utf8": 1, | "utf8": 1, | ||
"apnamespace": "8000", | "apnamespace": "8000", | ||
"apfilterredir": " | "apfilterredir": "nonredirects", | ||
"apfrom": " | //"apfrom": "שמן", | ||
"aplimit": " | "aplimit": "10" | ||
}).done((data) => { | }).done((data) => { | ||
//console.table(data); | //console.table(data); | ||
| שורה 22: | שורה 22: | ||
sum++; | sum++; | ||
if (sum >= 499) { | if (sum >= 499) { | ||
console.log('last was: ', pageName); | |||
} | } | ||
} | } | ||
| שורה 29: | שורה 29: | ||
function wikidataDesc(page) { | function wikidataDesc(page) { | ||
const | const pageName = page//.replace('איד', 'ייד')//.replace(/^רבי /, "").replace(/^הרב /, "").replace(/\"הייליגע\"/g, "הייליגע").replace('דעיוויד', 'דייוויד'); | ||
$.ajax({ | |||
url: '//www.wikidata.org/w/api.php', | |||
data: { | |||
'format': 'json', | |||
'action': 'wbgetentities', | |||
'sites': "yiwiki", | |||
'titles': pageName.replace("רוי:", ""),//.replace('מדינת ישראל', 'ישראל'), | |||
'props': 'descriptions', | |||
'languages': 'he|en|de' | |||
}, | |||
dataType: 'jsonp', | |||
cache: true | |||
}) | |||
.done(function (data) { | |||
console.log(data); | |||
if (data.success) { | |||
//console.table(data.success); | |||
$(function () { | |||
for (var e in data.entities) { | |||
if (e == -1) return; | |||
var descriptions = data.entities[e].descriptions; | |||
if (!descriptions) return console.log('ל' + pageName + ' אין מידע ויקינתונים.'); | |||
//const description = descriptions.yi.value; | |||
//console.table(e); | |||
//console.log(pageName + ' : ' + description); | |||
console.timeLog('מדידת זמן', '2'); | |||
var params = { | |||
"action": "query", | |||
"format": "json", | |||
"titles": pageName, | |||
"prop": "categories", | |||
"clcategories": "קאַטעגאָריע:בלעטער מיט קורצע דעסקריפציע" | |||
} | |||
var api = new mw.Api(); | |||
api.get(params).done(function (data) { | |||
for (const p in data.query.pages) { | |||
console.log(data.query.pages[p]); | |||
if (!("categories" in data.query.pages[p])) { | |||
addDesc(pageName, descriptions); | |||
} | } | ||
}) | } | ||
}) | |||
} | |||
}); | |||
} | |||
} | }); | ||
} | } | ||
function addDesc(pageName, text) { | function addDesc(pageName, descriptions) { | ||
var text; | |||
if ('en' in descriptions) { | |||
text += 'ענגליש=' + descriptions.en.value + '|'; | |||
} | |||
if ('he' in descriptions) { | |||
text += 'העב=' + descriptions.he.value + '|'; | |||
} | |||
if ('de' in descriptions) { | |||
text += 'דייטש=' + descriptions.de.value + '|'; | |||
} | |||
var params = { | var params = { | ||
"action": "edit", | "action": "edit", | ||
"format": "json", | "format": "json", | ||
"title": pageName, | "title": pageName, | ||
"summary": "דעסקריפציע | "summary": "דעסקריפציע", | ||
"minor": 1, | "minor": 1, | ||
"bot": 1, | "bot": 1, | ||
"prependtext": '{{דעסקריפציע|' + text + '}}\n', | "prependtext": '{{דעסקריפציע||' + text + '}}\n', | ||
"appendtext": '\n[' + '[קאַטעגאָריע:וויקידאטא דעסקריפציע]]', | //"appendtext": '\n[' + '[קאַטעגאָריע:וויקידאטא דעסקריפציע]]', | ||
"utf8": 1 | "utf8": 1 | ||
}, | }, | ||