维基新闻:維基新聞工具/強迫更新/purge.js

维基新闻,自由的新闻源

/*

 *
 * 增加“強制刷新”按鈕
 */
addOnloadHook(function(){
	var ca_history = document.getElementById( "ca-history" );
	if ( ca_history && document.location.href.indexOf(wgServer+wgArticlePath.replace("$1","")) == 0 ){
		var newA = document.createElement( "a" );
		newA.setAttribute( "href" , ca_history.firstChild.href.replace( "=history" , "=purge" ) );
		newA.appendChild( document.createTextNode( wgULS('刷新缓存','清除快取') ) );
		var newLi = document.createElement( "li" );
		newLi.appendChild( newA );
		var ul = ca_history.parentNode;
		ul.appendChild( newLi );
	}
});
//