注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
/* This is the script to add CGI:IRC login box to random pages (like [[WN:IRC]]). Please report problems to [[m:n:user talk:Bawolff]] (http://en.wikinews.org/wiki/user_talk:Bawolff ). modifications may take some time to get through caching. For yourself you can do a hard refresh of [{{SERVER}}/w/index.php?title=Mediawiki:Irc.js&action=raw&ctype=text/javascript&dontcountme=s this page] to make mods go live. From http://en.wikinews.org/wiki/mediawiki:Irc.js this is version 2.0. If you have any complaints, comments requests, please contact me at http://en.wikinews.org/wiki/user_talk:Bawolff :Just add <code><nowiki><div id="cgiircbox"/> </nowiki></code> (some wikis may need <code><nowiki><div id="cgiircbox"></div> </nowiki></code>) to a random page. You can style and add classes to thsi div if you want. in fact it doesn' even have to be a div, but a block level element is recommended (could be <code><nowiki><center id="cgiircbox"/> </nowiki></code>) Note: This is heavily based on the login page from CGI:IRC 0.5 (or more specificly it is a reimplementation of the login page in javascript, to get arround restrictions on which elements can be added to a mediawiki page, plus a few extra features added along the way). CGI:IRC is made by David Leadbeater and is under the GPL. See http://cgiirc.sf.net . (therefor i geuss you could consider the entire combined thing under the gpl. I'm not a 100% sure how the copyright issue for this works, in any case I'm ok with any of my edits to the script being GPL) <source lang="javascript"> */ /*extern wgUserName wgUserGroups, new_input, new_element, new_label, setcharset*/ function add_irc() { var debug = false; var irc_div = document.getElementById("cgiircbox"); if (irc_div) { var ircframe = document.createElement("iframe"); var src_attr = document.createAttribute("src"); var dim = new Array(document.createAttribute("width"), document.createAttribute("height")); src_attr.nodeValue = "//webchat.freenode.net/?channels=%23wikivoyage-zh&uio=MT1mYWxzZQ9a&prompt=1&nick=" + (mw.config.get('wgUserName') || ''); dim[0].nodeValue = "100%"; dim[1].nodeValue = "500"; ircframe.setAttributeNode(src_attr); ircframe.setAttributeNode(dim[0]); ircframe.setAttributeNode(dim[1]); irc_div.appendChild(ircframe); } } //because this is already from a load event add_irc(); //</source>