User:Gxnx0xmx0xn/gn0Marks.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. |
This user script seems to have a documentation page at User:Gxnx0xmx0xn/gn0Marks. |
// gn0Marks //
//
// A bookmarking tool for Wikipedia.
// Adapted (i.e., jury-rigged) in 2015 by User:Gxnx0xmx0xn on enwp from WikiMarks by User:Twinzor on enwp.
//
// See User:Gxnx0xmx0xn/gn0Marks for more info on installation.
//////////////////////////
//----------------------//
//---gn0m0n.com----//
//----------------------//
//////////////----------//
//////////////----------//
//////////////----------//
//////////////----------//
//////////////----------//
//////////////----------//
//////////////////////////
// PS: I don't really know JavaScript so this is probably a klugey solution. But it works for me.
//Reading configuration or setting defaults if not present:
if(typeof markThisTabTitleConfig == 'undefined') {
var markThisTitle="Add to gn0Marks";
}
else {
var markThisTitle= markThisTabTitleConfig;
}
if(typeof myMarksTitleConfig == 'undefined') {
var myMarksTitle="My gn0Marks";
}
else {
var markThisTitle= markThisTabTitleConfig;
}
if(typeof WikimarkConfigWikimarksPage == 'undefined') {
var wikimarkspage = "/mygn0Marks";
}
else {
var wikimarkspage = "/"+WikimarkConfigWikimarksPage;
}
if(typeof WikimarkConfigKeepSection == 'undefined') {
var wikimarksect = 0;
}
else {
var wikimarksect = WikimarkConfigKeepSection;
}
if(typeof WikimarkConfigListType == 'undefined') {
var listtype = "*";
}
else {
var listtype = WikimarkConfigListType;
}
if(typeof WikimarkConfigAddMenu == 'undefined') {
var addMenulocation = "p-cactions";
var menuPrefix = "ca-";
}
else if( WikimarkConfigAddMenu == "cactions" ) {
var addMenulocation = "p-cactions";
var menuPrefix = "ca-";
}
else if( WikimarkConfigAddMenu == "personal" ) {
var addMenulocation = "p-personal";
var menuPrefix = "pt-";
}
else if( WikimarkConfigAddMenu == "toolbox" ) {
var addMenulocation = "p-tb";
var menuPrefix = "t-";
}
else if( WikimarkConfigAddMenu == "navigation" ) {
var addMenulocation = "p-navigation";
var menuPrefix = "n-";
}
else {
var addMenulocation = "p-cactions";
var menuPrefix = "ca-";
}
if(typeof WikimarkConfigViewMenu == 'undefined') {
var viewMenulocation = "p-cactions";
var menuPrefixV = "ca-";
}
else if( WikimarkConfigViewMenu == "cactions" ) {
var viewMenulocation = "p-cactions";
var menuPrefixV = "ca-";
}
else if( WikimarkConfigViewMenu == "personal" ) {
var viewMenulocation = "p-personal";
var menuPrefixV = "pt-";
}
else if( WikimarkConfigViewMenu == "toolbox" ) {
var viewMenulocation = "p-tb";
var menuPrefixV = "t-";
}
else if( WikimarkConfigViewMenu == "navigation" ) {
var viewMenulocation = "p-navigation";
var menuPrefixV = "n-";
}
else {
var viewMenulocation = "p-cactions";
var menuPrefixV = "ca-";
}
if(typeof WikimarkConfigWikimarksUsername == 'undefined') {
var wikimarkEncodedUserName = encodeURIComponent(wgUserName);
}
else {
var wikimarkEncodedUserName = WikimarkConfigWikimarksUsername;
}
var wikimarklinkprefix = wgServer+wgScript;
$(WikiMarkInit);
function WikiMarkInit () {
if(typeof WikimarkConfigViewNextTo == 'undefined') {
var viewNextto = '';
}
else {
var viewNextto = document.getElementById(menuPrefixV+WikimarkConfigViewNextTo);
}
if(typeof WikimarkConfigAddNextTo == 'undefined') {
var addNextto = '';
}
else {
var addNextto = document.getElementById(menuPrefix+WikimarkConfigAddNextTo);
}
addPortletLink (addMenulocation, 'javascript:doAddWikiMark()', markThisTitle, menuPrefix+'addwikimark', 'Bookmark this page', '', addNextto);
addPortletLink (viewMenulocation, wikimarklinkprefix+"?title=User:"+wikimarkEncodedUserName+wikimarkspage, myMarksTitle, menuPrefixV+'showwikimark', 'Open your gn0Marks', '', viewNextto);
}
function doAddWikiMark () {
var wikimarkNewpage = wgPageName.replace(/_/g, " ");
if(wikimarkNewpage.indexOf("File:")==0) {
wikimarkNewpage = ":" + wikimarkNewpage;
}
else if(wikimarkNewpage.indexOf("Category:")==0) {
wikimarkNewpage = ":" + wikimarkNewpage;
}
var wikimarkNewpageName = wikimarkNewpage;
if(wikimarksect == 1) {
var newpageURL = location.href;
if(newpageURL.indexOf("#")) {
anchor = newpageURL.split("#");
newpageSect = anchor[1];
var wikimarkNewpageLink = wikimarkNewpage;
wikimarkNewpage = wikimarkNewpage + "#" + newpageSect;
wikimarkNewpage = wikimarkNewpage.replace(/_/g, " ");
wikimarkNewpageName = wikimarkNewpageLink + " (Section: " + newpageSect + ")";
}
}
if(wikimarkNewpageName == wikimarkNewpage) {
var wikimarkLinktext = wikimarkNewpage;
}
else {
var wikimarkLinktext = wikimarkNewpage+"|"+wikimarkNewpageName;
}
var f;
f=window.open(wikimarklinkprefix+"?title=User:"+wikimarkEncodedUserName+wikimarkspage+"&action=edit")
f.id="WikiMarksLoader";
f.onload=function() {
var wikimark_cmt = "Adding [["+wikimarkNewpage+"]] to my WikiMarks list.";
e=f.document.editform;
e.wpTextbox1.value+=listtype+"["+"["+wikimarkLinktext+"]"+"]\n";
e.wpSummary.value=wikimark_cmt;
e.wpSave.click();
// f.close(); // This closes the gn0Marks window. You can comment it out if you prefer.
jsMsg("You're the man now, dawg. '''"+wikimarkNewpageName+"''' has been added to your gn0Marks.");
};
}