User:Twinzor/wikimark.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Twinzor/wikimark. |
//<nowiki>
//WikiMark
//
//A bookmarking tool for Wikipedia.
//
//By User:Twinzor on enwp.
//
//99% of the code is copied from other scripts on WP.
//
//If you improve my sloppy code, I would
//appreaciate it if you could drop me
//a line on my talkpage. Thanks!
//
//To configure the script for yourself, you'll
//first have to copy it to a user subpage of
//you own.
//
//Configuration:
var wikimarkspage = "/WikiMarks"; //Where your WikiMarks are stored. Must begin with a /
var listtype = "*"; //Prefix for each WikiMark. Usually * or #, but can be anything.
var menulocation = "p-cactions"; //Menu location: "p-cactions" = Content actions, "p-personal" = Personal tools, "p-navigation", "p-toolbox".
//Don't edit after this unless you know what you're doing.
var wikimarklinkprefix = wgServer+wgScript;
var wikimarkEncodedUserName = encodeURIComponent(wgUserName);
addOnloadHook(WikiMarkInit);
function WikiMarkInit () {
addPortletLink (menulocation, 'javascript:doAddWikiMark()', 'WikiMark', 'ca-addwikimark', 'WikiMark this page');
addPortletLink (menulocation, wikimarklinkprefix+"?title=User:"+wikimarkEncodedUserName+wikimarkspage, 'My WikiMarks', 'ca-showwikimark', 'Open your WikiMarks');
}
function doAddWikiMark () {
var wikimark_cmt = "Adding [["+wikimarkNewpage+"]] to my WikiMarks list.";
var wikimarkNewpage = wgPageName;
var f;
f=document.createElement("IFRAME");
f.id="WikiMarksLoader";
f.onload=function() {
var wikimark_cmt = "Adding [["+wikimarkNewpage+"]] to my WikiMarks list.";
e=f.contentWindow.document.editform,e.wpTextbox1.value+=listtype+"["+"["+wikimarkNewpage+"]"+"]\n",e.wpSummary.value=wikimark_cmt,e.wpSave.click();
var iframe = document.getElementById('WikiMarksLoader');
iframe.parentNode.removeChild(iframe);
jsMsg("'''"+wikimarkNewpage+"''' has been added to your WikiMarks.");
};
f.src=wikimarklinkprefix+"?title=User:"+wikimarkEncodedUserName+wikimarkspage+"&action=edit",document.body.appendChild(f);
};
// </nowiki>