Difference between revisions of "User:Π π π/common.js"

From Geohashing
(trying this out, will have to modify)
 
(like this?)
 
(2 intermediate revisions by the same user not shown)
Line 35: Line 35:
 
     var expeditionTemplate = meetupTemplate + "\n\
 
     var expeditionTemplate = meetupTemplate + "\n\
 
==Location==\n\
 
==Location==\n\
 +
on a field in , Schleswig-Holstein\n\
 
\n\
 
\n\
 
==Participants==\n\
 
==Participants==\n\
 
*[[User:π π π|π π π]] ([[User talk:π π π|talk]])\n\
 
*[[User:π π π|π π π]] ([[User talk:π π π|talk]])\n\
<!--*[[User:Leidenfrost|Leidenfrost]]\n\-->
 
 
\n\
 
\n\
==Plans==\n\
+
==Expedition==\n\
\n\
 
<!--==Expedition==\n\
 
 
\n\
 
\n\
 
==Photos==\n\
 
==Photos==\n\
will follow shortly ( pictures)\n\
+
<gallery mode="packed" heights="150px">\n\
 +
<gallery/>\n\
 +
to follow\n\
 
\n\
 
\n\
 
==Achievements==\n\
 
==Achievements==\n\
 
Land geohash, Public transport geohash, Bicycle geohash\n\
 
Land geohash, Public transport geohash, Bicycle geohash\n\
{{#vardefine:ribbonwidth|100%}}" + ribbonsTemplate + "\n\
 
 
\n\
 
\n\
 
__NOTOC__\n\
 
__NOTOC__\n\
 
[[Category:Coordinates reached]]\n\
 
[[Category:Coordinates reached]]\n\
 
[[Category:Land geohash achievement]]\n\
 
[[Category:Land geohash achievement]]\n\
 +
[[Category:Public transport geohash achievement]]\n\
 
[[Category:Bicycle geohash achievement]]\n\
 
[[Category:Bicycle geohash achievement]]\n\
[[Category:Public transport geohash achievement]]\n\
+
[[Category:Expeditions]]\n\
[[Category:Expeditions]]-->\n\
+
{{location|DE|SH|SE}}\n\
[[Category:Expedition planning]]\n\
 
{{location|DE|SH|SE}}
 
 
";
 
";
  

Latest revision as of 10:33, 29 September 2024

// <includeonly>
function waitForWikiEditor(){
    if(typeof $("#wpTextbox1").wikiEditor === "function"){
        $("#wpTextbox1").wikiEditor("addToToolbar", {
            section: "main",
            group: "insert",
            tools: {
                buttonId: {
                    label: "Expedition template",
                    type: "button",
                    icon: "https://geohashing.site/images/thumb/4/4c/Landgeohash.png/22px-Landgeohash.png",
                    action: {
                        type: "encapsulate",
                        options: {
                            post: expeditionTemplate
                        }
                    }
                }
            }
        });
    }
    else{
        setTimeout(waitForWikiEditor, 250);
    }
}

var expeditionRegex = /\d{4}-\d{2}-\d{2}_-?\d{1,3}_-?\d{1,3}/
var expeditionMatch = location.toString().match(expeditionRegex)

if(expeditionMatch !== null && (mw.config.get(['wgAction']).wgAction === "edit" || mw.config.get(['wgAction']).wgAction === "submit")){
    var expeditionData = expeditionMatch[0].split("_")
    var ribbonsTemplate = "\n\{{land geohash|latitude=" + expeditionData[1] + "|longitude=" + expeditionData[2] + "|date=" + expeditionData[0] + "}}\n\{{Public transport geohash|latitude=" + expeditionData[1] + "|longitude=" + expeditionData[2] + "|date=" + expeditionData[0] + "| busline=  }}\n\<!--{{No trespassing|latitude=" + expeditionData[1] + "|longitude=" + expeditionData[2] + "|date=" + expeditionData[0] + "}}-->"
    var meetupTemplate = "{{meetup graticule|date=" + expeditionData[0] + "|lat=" + expeditionData[1] + "|lon=" + expeditionData[2] + "|graticule_link=}}"

    var expeditionTemplate = meetupTemplate + "\n\
==Location==\n\
on a field in , Schleswig-Holstein\n\
\n\
==Participants==\n\
*[[User:π π π|π π π]] ([[User talk:π π π|talk]])\n\
\n\
==Expedition==\n\
\n\
==Photos==\n\
<gallery mode="packed" heights="150px">\n\
<gallery/>\n\
to follow\n\
\n\
==Achievements==\n\
Land geohash, Public transport geohash, Bicycle geohash\n\
\n\
__NOTOC__\n\
[[Category:Coordinates reached]]\n\
[[Category:Land geohash achievement]]\n\
[[Category:Public transport geohash achievement]]\n\
[[Category:Bicycle geohash achievement]]\n\
[[Category:Expeditions]]\n\
{{location|DE|SH|SE}}\n\
";

    $(document).ready(waitForWikiEditor);
}
// </includeonly>