damian66 / Popmundo Youth Hostel 2016

// ==UserScript==
// @name         Popmundo Youth Hostel 2016
// @namespace    http://popmundo.com/
// @version      0.1
// @description  Popmundo Youth Hostel (list: 2235355.1)
// @author       Damian Bartosik
// @match        http://*.popmundo.com/World/Popmundo.aspx/City*
// @updateURL https://openuserjs.org/meta/damian66/Popmundo_Youth_Hostel_2016.meta.js
// @downloadURL https://openuserjs.org/src/scripts/damian66/Popmundo_Youth_Hostel_2016.user.js
// @grant        none
// ==/UserScript==

(function() {    

    function scriptInit() {
        var hostels = {
        8:   3172046, // Amsterdam, Melanie Wellmann
        35:  3117239, // Ankara, Luana Lindmeier
        61:  2820768, // Antalya, Varg Berkes
        58:  0, // Baku, Alev Serif
        9:  2791141, // Barcelona, Alessandro Bruno
        36:  2920964, // Belgrade, Janne Kauppi
        7:  1827216, // Berlin, Sirpa Virjonen
        33:   0, // Brussels, Nicolaas Burggraaf
        46:   0, // Bucharest, Ian Secker
        42:   3117280, // Budapest, Alessandra Zamperini
        17:   115485, // Buenos Aires, José Luis Álvarez
        60:  2985160, // Chicago, Amalthea l'Amoureux
        22:   3041571, // Copenhagen, Wes Toland
        29:  3140587, // Dubrovnik, Hase vom Berg
        27:  2443320, // Glasgow, Sophia Phillips
        19:  1173622, // Helsinki, Einari Kyöttilä
        30:  2823888, // Istanbul, Matthias Hake
        47:  2076307, // Izmir, Samira Devil
        55:  2366752, // Jakarta, Pekka Ruonela
        51:  1846674, // Johannesburg, Patrik Paulsson
        56:  0, // Kiev, Anatoliy Novikov
        5:  3064888, // London, Simona Moro Visconti
        14:   337811, // Los Angeles, Hartmut Hake
        24:  3156762, // Madrid, Jerico Aldaya
        54:  3108747, // Manila, Christian Munerati
        10:  3157024, // Melbourne, Eva Lundhskär
        32:   0, // Mexico City, Atte Näränen
        52:  2860497, // Milan, Enrica Marchetti
        38:  3179489, // Montreal, Gaia O'Reilly
        18:  0, // Moscow, Trevor Martin
        11:  2828625, // Nashville, Gun Akins
        6:  3129168, // New York, Mira Marshall
        20:   0, // Paris, Valéry Faye
        31:  3125632, // Porto, Jozien van Maanen
        25:   0, // Rio de Janeiro, Achmed Witte
        23:  3052320, // Rome, Britney Skye
        21:   0, // São Paulo, Achmed Witte
        49:  3117380, // Sarajevo, Britney Skye
        50:  3148267, // Seattle, Marloes Paalvast
        45:   675717, // Shanghai, Mason Bolger
        39:  3155057, // Singapore, Allan Brooks
        53:  1962951, // Sofia, Pekka Ruonela
        1:  2797038, // Stockholm, Greer Marshall
        62: 3047285, // Tokyo
        34:  0, // Tallinn, Lars-Erik Brennan
        16:   229736, // Toronto, Pascaline Foulquier
        26:   988565, // Tromsø, Alva Larsson
        28:  1743451, // Vilnius, Patrik Paulsson
        48:  3005106, // Warsaw, Blanka Trocha
        0:        0  // filler data. Ignore this   
    };        
        
        var cityId = jQ("#ctl00_cphRightColumn_ctl01_ddlCities").val();
        var hostelId = hostels[cityId];
        if(!hostelId) return;

        var item = jQ("<li/>");
        var link = jQ("<a/>", {
            href: "/World/Popmundo.aspx/Locale/" + hostelId,
            text: "Youth Hostel"
        }).appendTo(item);

        jQ("#mnuToolTipLocales").parent().prepend(item);
    }

    function addJQuery(callback) {
        var script = document.createElement("script");
        script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
        script.addEventListener('load', function() {
            var script = document.createElement("script");
            script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
            document.body.appendChild(script);
        }, false);
        document.body.appendChild(script);
    }
    
    addJQuery(scriptInit);

})();