« MediaWiki:Common-IntersectionCategorie.js » : différence entre les versions
Contenu supprimé Contenu ajouté
mAucun résumé des modifications |
m sélectionner pour montrer le requête en cours |
||
Ligne 58 :
add_dpl_result_to_page : function (datas) {
$("#bodyContent").html($("#bodyContent").html() + datas.parse.text["*"]);
var cat = [];▼
var nocat = [];▼
this.cat_from_string(location.search, cat, nocat);
if (cat.length)
this.set_selected(cat);
},
Ligne 72 ⟶ 77 :
exec_user_query : function () {
var cat = []
$("
cat.push($(this).text());
});
Ligne 80 ⟶ 85 :
},
build_listbox : function (
var text = "<select name='select_cat' id='select_cat' size='8' multiple='multiple'>\n";
for (var i = 0; i <
text += "<option value='" + i + "'>" +
return text + "</select>" + "<button type='button' onclick='intersection_categorie.exec_user_query()'>Exécuter la requête</button>";
},
build_dpl_query : function (
var text = "<DynamicPageList>count = 50\norder = sortkey\nshownamespace = false";
for (var i = 0; i <
text += "\ncategory = " +
for (var i = 0; i <
text += "\nnotcategory = " +
return text + "\n</DynamicPageList>";
},
dpl_query : function (
var query = this.build_dpl_query(
var url = mw.config.get("wgServer") + mw.config.get("wgScriptPath")
+ "/api.php?action=parse&callback=intersection_categorie.add_dpl_result_to_page"
Ligne 111 ⟶ 116 :
},
for (var i = 0 ; i < cat.length; ++i) {
for (var j = 0 ; j < this.possible_category.length; ++j) {
▲ query_from_string : function (str) {
if (cat[i].replace('_', ' ') == this.possible_category[j])
$("#select_cat option[value=" + j + "]").attr("selected", "selected");
}
}
},
cat_from_string : function (str, cat, nocat) {
if (str.charAt[0] = "?")
str = str.slice(1);
var params = str.split("&");
▲ var cat = [];
▲ var nocat = [];
for (var i = 0; i < params.length; ++i) {
var key_value = params[i].split("=");
Ligne 128 ⟶ 138 :
}
}
},
query_from_url : function () {
var cat = [];
var nocat = [];
this.cat_from_string(location.search, cat, nocat);
if (cat.length)
this.dpl_query(cat, nocat);
Ligne 137 ⟶ 153 :
$("title").text("Spécial:Intersection de catégorie")
$("#bodyContent").html(this.build_listbox(this.possible_category));
this.
}
}
|