| eflyjason added a comment. |
https://www.wikidata.org/wiki/User:Eflyjason/Gadget-CreateNewItem.js
var currentFieldText = "";
$(document).on('input propertychange paste', ".ui-suggester-input", function() {
currentFieldText = $(this).val();
//console.log("Entering: "+currentFieldText);
});
$(document).on('DOMSubtreeModified', ".ui-entityselector-list",function(){
var firstLi = $(this).find("li").first();
var isNotFound = firstLi.hasClass('ui-entityselector-notfound');
console.log('Current Text Field content: '+currentFieldText+". Not found: "+isNotFound);
if(isNotFound){
var innerA = firstLi.find("a").first();
innerA.attr("href", "https://www.wikidata.org/wiki/Special:NewItem?label="+currentFieldText).attr("target", "_blank");
}
});The basic feature should be working right now :D (though I'm not sure if it's the best approach?)
I will optimize it and make it into a popup later :D
TASK DETAIL
EMAIL PREFERENCES
To: eflyjason
Cc: eflyjason, Ladsgroup, Liuxinyu970226, PokestarFan, Lydia_Pintscher, ChristianKl, Sjoerddebruin, daniel, Ricordisamoa, matej_suchanek, Aklapper, Mvolz, Bright1055, Lahi, Gq86, Toppole69, GoranSMilovanovic, Mine0901, Jayprakash12345, QZanden, srishakatux, dachary, Beeyan, Pahadiahimanshu, Manrajsinghgrover, Keer25, MtDu, D3r1ck01, RexxS, Wikidata-bugs, aude, jayvdb, Mbch331, Jay8g
Cc: eflyjason, Ladsgroup, Liuxinyu970226, PokestarFan, Lydia_Pintscher, ChristianKl, Sjoerddebruin, daniel, Ricordisamoa, matej_suchanek, Aklapper, Mvolz, Bright1055, Lahi, Gq86, Toppole69, GoranSMilovanovic, Mine0901, Jayprakash12345, QZanden, srishakatux, dachary, Beeyan, Pahadiahimanshu, Manrajsinghgrover, Keer25, MtDu, D3r1ck01, RexxS, Wikidata-bugs, aude, jayvdb, Mbch331, Jay8g
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
