Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// Based on Gadget-CropTool, Gadget-Tineye.js and User:Peterneubauer/mapillary.js(function(mw,$){if(mw.config.get('wgNamespaceNumber')!==6)return;if(mw.config.get('wgAction')!='view')return;// could a new separate css file would break compatibility with current userscript?varcustomStyle='<style>#mapillary-commons-upload {position: absolute;top: 0;right: 0;margin: auto;background: #FFF;border: 2px solid #36AF6D;padding: 5px;border-radius: 4px;color: #36AF6D;margin-top: 5px;margin-right: 5px;font-weight: bold;display: none;}</style>';$('head').append(customStyle);varkeys=$('.mapillary_key');if(keys.length>0&&$(keys[0]).text().length>0){$(function(){mw.loader.load('https://unpkg.com/mapillary-js@2.6.0/dist/mapillary.min.css','text/css');$.getScript('https://unpkg.com/mapillary-js@2.6.0/dist/mapillary.min.js',function(){$('#mw-content-text').append('<h2>Mapillary View</h2>').append('<div id="mapillary" style="width: 640px; height: 480px;"></div>');varkey=$(keys[0]).text();varviewer=newMapillary.Viewer('mapillary','WHZlUV9FNXhFZ24xZEZQRHZzUlZ3QTplNDE1Y2RiMWY3MTliZDc0',key);// upload button$('#mapillary').append('<a id="mapillary-commons-upload" href="">Upload</a>');varuploadEndpoint='https://tools.wmflabs.org/mapillary-commons/mapillary2commons?mapillary=';varuploadBtn=$('#mapillary-commons-upload');viewer.on(Mapillary.Viewer.nodechanged,function(node){if(node.key!==key){uploadBtn.attr('href',uploadEndpoint+node.key);uploadBtn.show();}else{uploadBtn.hide();}});});});}})(mediaWiki,jQuery);