Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:TheDJ/Gadget-HotCat.js');
importScript('User:Smith609/toolbox.js');
importScript('Wikipedia:FORMATTER');
importScript('User:Drilnoth/codefixer.js');
importScript('User:Cameltrader/Advisor.js');

function rsswatch(){

    var page = wgPageName;           //.replace(/_/g, " ");

    var f=document.createElement("IFRAME");
    f.id="RssWatchLoader";
    f.onload=function(){
        var summary = "Adding [["+page+"]] to my rss watchlist. (Using [[User:Cubathy/RSSWatch]])";
        e=f.contentWindow.document.editform,e.wpTextbox1.value+="\n{{pwli|"+page+"}}",e.wpSummary.value=summary,e.wpSave.click();
        var iframe = document.getElementById('RssWatchLoader');
        iframe.style.display="none";
//rsswatch2()
}
f.src="http://en.wikipedia.org/w/index.php?title=User:Cubathy/RSS_Watchlist&action=edit",document.body.appendChild(f);

    var f2=document.createElement("IFRAME");
    f2.id="WatchLoader";
    f2.onload=function(){
         var iframe = document.getElementById('WatchLoader');
         iframe.style.display="none";
alert("done");
}

    f2.src="http://en.wikipedia.org/wiki/"+page+"?action=watch",document.body.appendChild(f2);


}

function rsswatch_init() {
	//if( wgNamespaceNumber == 3 ) {
		mw.util.addPortletLink( 'p-cactions', "javascript:rsswatch()" , "rss", "rsswatch", "Watch and add to RSS", "");
	//}
}

$(rsswatch_init);