User:Hat600/script/flyovers.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// <nowiki>
/* 各项数据排列:名称、南北向道路、东西向道路、桥长描述、面积或宽度数据、描述、年份数字、所在区 */
;(function($){
// UI
var fixitem = '<div style="position: fixed; bottom: 0; left: 0; width: 100%; height: 30%; z-index: 21; background: #FFFFFF; border-top: 2px solid black; padding: 2em;"><button id="CRgobutton1">Go</button><button id="CRskipbutton">Skip</button></div>';
$('#bodyContent').append(fixitem);
$('.wikitable tbody').children('tr:first-child').css('background-color', '#FFFF00').attr('id', 'CRonhold');
$('#CRskipbutton').bind('click', function(){
$('#CRonhold').remove();
$('.wikitable tbody').children('tr:first-child').css('background-color', '#FFFF00').attr('id', 'CRonhold');
});
$('#CRgobutton1').bind('click', function(){
var CRarticletitle = $('#CRonhold').children('td:eq(0)').text()
var CRNS = $('#CRonhold').children('td:eq(1)').text()
var CREW = $('#CRonhold').children('td:eq(2)').text()
var CRlength = $('#CRonhold').children('td:eq(3)').text()
var CRwidth = $('#CRonhold').children('td:eq(4)').text()
var CRdesc = $('#CRonhold').children('td:eq(5)').text()
var CRyear = $('#CRonhold').children('td:eq(6)').text()
var CRdistrict = $('#CRonhold').children('td:eq(7)').text()
var wikitext = '\'\'\'' + CRarticletitle + '\'\'\'位于[[北京市]][[' + CRdistrict + ']],是[[' + CREW + '|' + CREW + ']](东西向)和[[' + CRNS + '|' + CRNS + ']](南北向)交汇处的一座[[立交桥]]。该桥' + CRdesc + ',' + CRlength + ',' + CRwidth + '。于[[' + CRyear + '年]]建成。<ref>{{cite book|title=《北京志·市政卷·道桥志》|year=2001|publisher=北京出版社|location=北京|isbn=978-7-200-04454-7|author=北京市地方志编纂委员会|pages=473-484}}</ref>\n== 参考资料 ==\n{{reflist}}\n[[Category:北京市海淀区]]\n[[Category:北京立交桥]]'
editToken = mw.user.tokens.get( 'editToken' );
$.ajax({
url: 'https://zh.wikipedia.org/w/api.php',
type: 'POST',
data: {
format: 'xml',
action: 'edit',
title: CRarticletitle,
text: wikitext,
summary: '机器人建立新条目,北京立交桥',
minor: true,
bot: 1,
createonly: 1,
token: editToken
},
success: function(data){
console.log("success");
}
});
$('#CRonhold').remove();
$('.wikitable tbody').children('tr:first-child').css('background-color', '#FFFF00').attr('id', 'CRonhold');
});
})(jQuery);
// </nowiki>