Version 1.4beta3 de ScrutariJs
This commit is contained in:
parent
33bb3ee4e5
commit
8e79fb4c17
@ -176,6 +176,10 @@ Scrutari.Lav.changeHandler = function (client, element, name) {
|
||||
}
|
||||
};
|
||||
|
||||
Scrutari.Lav.mainsearchCallback = function (client, searchUnit) {
|
||||
$("#scrutari_lav_sequence").html(Scrutari.Lav.formatSearchSequence(client, searchUnit));
|
||||
};
|
||||
|
||||
Scrutari.Lav.getApiSettings = function () {
|
||||
return {
|
||||
name: "libreavous",
|
||||
@ -212,18 +216,16 @@ Scrutari.Lav.getInitOptions = function () {
|
||||
uiInit: Scrutari.Lav.init,
|
||||
ignoreElement: null,
|
||||
isFilterEnable: null,
|
||||
mainsearchCallback: function (client, searchUnit) {
|
||||
$("#scrutari_lav_sequence").html(Scrutari.Lav.formatSearchSequence(client, searchUnit));
|
||||
},
|
||||
mainsearchErrorCallback: null,
|
||||
subsearchCallback: null,
|
||||
subsearchErrorCallback: null,
|
||||
initFilterByQuery: null,
|
||||
newSearchDisplay: Scrutari.Lav.newSearchDisplay,
|
||||
startLoading: null,
|
||||
endLoading: null,
|
||||
actionHandler: Scrutari.Lav.actionHandler,
|
||||
changeHandler: Scrutari.Lav.changeHandler
|
||||
},
|
||||
searchCallbacks: {
|
||||
mainsearch: Scrutari.Lav.mainsearchCallback,
|
||||
qidsearch: Scrutari.Lav.mainsearchCallback
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* version: 1.4alpha16 */
|
||||
/* version: 1.4beta3 */
|
||||
var Scrutari = {};
|
||||
Scrutari.log = function (msg) {
|
||||
if ((console) && (console.log)) {
|
||||
@ -2126,8 +2126,8 @@ Scrutari.History.prototype.loadHistory = function (historyName) {
|
||||
history.updateCurrent(historyName);
|
||||
$historyBlock.addClass(client.cssClasses.activeHistory);
|
||||
client.displaySearchUnit(historySearchUnit, false);
|
||||
if (client.functions.mainsearchCallback) {
|
||||
client.functions.mainsearchCallback(client, historySearchUnit);
|
||||
if (client.functions.searchCallbacks.mainsearch) {
|
||||
client.functions.searchCallbacks.mainsearch(client, historySearchUnit);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -2203,13 +2203,19 @@ Scrutari.Client = function (api, clientId) {
|
||||
initFilterByQuery: Scrutari.DefaultUi.initFilterByQuery,
|
||||
initForms: Scrutari.DefaultUi.initForms,
|
||||
isFilterEnable: Scrutari.DefaultUi.isFilterEnable,
|
||||
mainsearchCallback: Scrutari.DefaultUi.mainsearchCallback,
|
||||
mainsearchErrorCallback: null,
|
||||
modalAction: Scrutari.DefaultUi.modalAction,
|
||||
newSearchDisplay: Scrutari.DefaultUi.newSearchDisplay,
|
||||
startLoading: Scrutari.DefaultUi.startLoading,
|
||||
subsearchCallback: Scrutari.DefaultUi.subsearchCallback,
|
||||
subsearchErrorCallback: null
|
||||
startLoading: Scrutari.DefaultUi.startLoading
|
||||
};
|
||||
this.searchCallbacks = {
|
||||
mainsearch: Scrutari.DefaultUi.mainsearchCallback,
|
||||
qidsearch: Scrutari.DefaultUi.qidsearchCallback,
|
||||
subsearch: Scrutari.DefaultUi.subsearchCallback
|
||||
};
|
||||
this.errorCallbacks = {
|
||||
mainsearch: null,
|
||||
qidsearch: null,
|
||||
subsearch: null
|
||||
};
|
||||
this.cssClasses = {
|
||||
disabled: "scrutari-Disabled",
|
||||
@ -2670,17 +2676,8 @@ Scrutari.Client.prototype.searchCallback = function (searchUnit) {
|
||||
var client = this;
|
||||
client.displaySearchUnit(searchUnit, true);
|
||||
client.endLoading();
|
||||
switch(searchUnit.searchOrigin) {
|
||||
case "mainsearch":
|
||||
if (client.functions.mainsearchCallback) {
|
||||
client.functions.mainsearchCallback(client, searchUnit);
|
||||
}
|
||||
break;
|
||||
case "subsearch":
|
||||
if (client.functions.subsearchCallback) {
|
||||
client.functions.subsearchCallback(client, searchUnit);
|
||||
}
|
||||
break;
|
||||
if (client.searchCallbacks.hasOwnProperty(searchUnit.searchOrigin)) {
|
||||
client.searchCallbacks[searchUnit.searchOrigin](client, searchUnit);
|
||||
}
|
||||
};
|
||||
Scrutari.Client.prototype.errorCallback = function (error, searchOrigin) {
|
||||
@ -2689,17 +2686,8 @@ Scrutari.Client.prototype.errorCallback = function (error, searchOrigin) {
|
||||
client.functions.displayError(client, error, searchOrigin);
|
||||
}
|
||||
client.endLoading();
|
||||
switch(searchOrigin) {
|
||||
case "mainsearch":
|
||||
if (client.functions.mainsearchErrorCallback) {
|
||||
client.functions.mainsearchErrorCallback(client, error);
|
||||
}
|
||||
break;
|
||||
case "subsearch":
|
||||
if (client.functions.subsearchErrorCallback) {
|
||||
client.functions.subsearchErrorCallback(client, error);
|
||||
}
|
||||
break;
|
||||
if (client.errorCallbacks.hasOwnProperty(searchOrigin)) {
|
||||
client.errorCallbacks[searchOrigin](client, error);
|
||||
}
|
||||
};
|
||||
Scrutari.Client.prototype.buildSearchRequestParameters = function (customParameters) {
|
||||
@ -2841,6 +2829,16 @@ Scrutari.Client.init = function (api, clientId, options, callback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.searchCallbacks) {
|
||||
for(let callbackKey in options.searchCallbacks) {
|
||||
client.searchCallbacks[callbackKey] = options.searchCallbacks[callbackKey];
|
||||
}
|
||||
}
|
||||
if (options.errorCallbacks) {
|
||||
for(let callbackKey in options.errorCallbacks) {
|
||||
client.errorCallbacks[callbackKey] = options.errorCallbacks[callbackKey];
|
||||
}
|
||||
}
|
||||
if (options.cssClasses) {
|
||||
for(let cssKey in options.cssClasses) {
|
||||
client.cssClasses[cssKey] = options.cssClasses[cssKey];
|
||||
@ -3350,10 +3348,10 @@ Scrutari.DefaultUi.checkInitialQuery = function (client) {
|
||||
if (client.functions.initFilterByQuery) {
|
||||
client.functions.initFilterByQuery(client, searchUnit);
|
||||
}
|
||||
client.mainsearchResultCallback(searchUnit);
|
||||
client.searchCallback(searchUnit);
|
||||
},
|
||||
errorCallback: function (error) {
|
||||
client.mainsearchErrorCallback(error);
|
||||
client.errorCallback(error, "qidsearch");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -3384,6 +3382,9 @@ Scrutari.DefaultUi.mainsearchCallback = function (client, searchUnit) {
|
||||
$parametersDisplayButton.click();
|
||||
}
|
||||
};
|
||||
Scrutari.DefaultUi.qidsearchCallback = function (client, searchUnit) {
|
||||
Scrutari.DefaultUi.mainsearchCallback(client, searchUnit);
|
||||
};
|
||||
Scrutari.DefaultUi.subsearchCallback = function (client, searchUnit) {
|
||||
client.$count("stats-result", 'update', searchUnit.getFicheCount());
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user