MediaWiki:PinnedActivity.js

/*Simple Pinned Activity Module                     */ // -> Adds an extra column on the top for highlights //

var pins = window.pins || {} ;

// Plug: Actual pinning activity                    // function XPplug{ if ($(".pinned").length)return; // Prevent Duplicate for (let ii=0; ii < pins.length; ++ii) { let pin = pins[ii]; if(!XPverify(pin,ii))continue; let pinnail = $('')[0]; let pinhead = $(''+pin.title+'')[0]; let pinpaper = document.createElement("li"); pinpaper.className = "pinned"; pinpaper.appendChild(pinnail); pinpaper.appendChild(pinhead); if(pin.description!==undefined){ pinpaper.appendChild(document.createElement("br")); pinpaper.appendChild(document.createTextNode(pin.description)); }       let pinfeed = document.getElementsByClassName("activityfeed")[0]; pinfeed.insertBefore(pinpaper,pinfeed.firstChild); } }

function XPverify(pin,n){ let errMsg=[]; if (pin.link===undefined) errMsg.push(" Missing Link"); if (pin.title===undefined) errMsg.push(" Missing Title"); //if (isNaN(pin.order)&&pin.order!==undefined) errMsg.push(" Order is not a number"); if (errMsg.length>0)console.log("Error in pin #"+n+":"+errMsg); return errMsg.length===0; }

//$(func): Page check                               // $(function{   if(wgPageName == "Special:WikiActivity")    XPplug; });

//AjaxRC Compatibility                              // window.ajaxCallAgain = window.ajaxCallAgain || []; window.ajaxCallAgain.push(XPplug);