WIP: Aureplop/kpsul js refactor #501

Draft
delobell wants to merge 215 commits from aureplop/kpsul_js_refactor into master
6 changed files with 7 additions and 6 deletions
Showing only changes of commit 2eba6892a2 - Show all commits

View file

@ -1,3 +1,5 @@
var cancelHistory = new Event("history_cancel");
class KHistory { class KHistory {
static get default_options() { static get default_options() {
@ -70,7 +72,7 @@ class KHistory {
} }
cancel_operations(to_cancel) { cancel_operations(to_cancel) {
var on_success = () => $(document).trigger("custom_reset"); var on_success = () => document.dispatchEvent(cancelHistory);
api_with_auth({ api_with_auth({
url: Urls['kfet.kpsul.cancel_operations'](), url: Urls['kfet.kpsul.cancel_operations'](),

View file

@ -133,7 +133,6 @@ class Config {
} }
var resetEvent = new Event("custom_reset");
$(document).ready(function() { $(document).ready(function() {
$(window).scroll(function() { $(window).scroll(function() {

View file

@ -43,7 +43,7 @@ class KPsulManager {
_init_events() { _init_events() {
var that = this ; var that = this ;
$(document).on("custom_reset", function(e) { $(document).on("history_cancel", function(e) {
that.reset(true); that.reset(true);
that.focus; that.focus;
}); });

View file

@ -109,7 +109,7 @@ $(document).ready(function() {
var khistory = new KHistory({'no_trigramme': true}); var khistory = new KHistory({'no_trigramme': true});
$(document).on("custom_reset", function(e) { $(document).on("cancel_history", function(e) {
khistory.selection.reset(); khistory.selection.reset();
}); });

View file

@ -129,7 +129,7 @@ $(document).ready(function() {
updateHistory(); updateHistory();
}); });
$(document).on("custom_reset", function(e) { $(document).on("cancel_history", function(e) {
khistory.selection.reset(); khistory.selection.reset();
}); });

View file

@ -53,7 +53,7 @@ $(document).ready(function() {
var history = new KHistory(); var history = new KHistory();
$(document).on("custom_reset", function(e) { $(document).on("cancel_history", function(e) {
khistory.selection.reset(); khistory.selection.reset();
}); });