Upgrade to jQuery 3.4.1 with CDN & fallback
parent
1ec5a60b86
commit
701058ede0
10
index.html
10
index.html
|
@ -59,7 +59,15 @@
|
|||
</p>
|
||||
</div>
|
||||
|
||||
<script src="lib/jquery.min.js"></script>
|
||||
<script
|
||||
src="https://code.jquery.com/jquery-3.4.1.min.js"
|
||||
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
window.jQuery || document.write('<script src="lib/jquery-3.4.1.min.js"><\/script>');
|
||||
</script>
|
||||
|
||||
<script src="lib/pep.js"></script>
|
||||
<script src="lib/canvas.toBlob.js"></script>
|
||||
<script src="lib/gif.js/gif.js"></script>
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -181,7 +181,7 @@ function $Component(name, orientation, $el){
|
|||
};
|
||||
|
||||
$c.show = function(){
|
||||
$($c[0]).show();
|
||||
$($c[0]).show(); // avoid recursion
|
||||
if($.contains($w[0], $c[0])){
|
||||
$w.show();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ function $MenuBar(menus){
|
|||
});
|
||||
$item.on("pointerover", function(){
|
||||
$menu_popup.triggerHandler("update");
|
||||
$item.focus();
|
||||
$item[0].focus();
|
||||
});
|
||||
|
||||
if(item.checkbox){
|
||||
|
@ -104,7 +104,7 @@ function $MenuBar(menus){
|
|||
open_tid = setTimeout(open_submenu, 200);
|
||||
});
|
||||
$item.add($submenu_popup).on("pointerout", function(){
|
||||
$menu_popup.closest(".menu-container").find(".menu-button").focus();
|
||||
$menu_popup.closest(".menu-container").find(".menu-button")[0].focus();
|
||||
if(open_tid){clearTimeout(open_tid);}
|
||||
if(close_tid){clearTimeout(close_tid);}
|
||||
close_tid = setTimeout(function(){
|
||||
|
@ -141,7 +141,11 @@ function $MenuBar(menus){
|
|||
$item.on("pointerout", function(){
|
||||
if($item.is(":visible")){
|
||||
$menus.triggerHandler("info", "");
|
||||
$menu_popup.closest(".menu-container").find(".menu-button").focus();
|
||||
// may not exist for submenu popups
|
||||
var menu_button = $menu_popup.closest(".menu-container").find(".menu-button")[0];
|
||||
if(menu_button){
|
||||
menu_button.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -161,7 +165,7 @@ function $MenuBar(menus){
|
|||
}
|
||||
if(String.fromCharCode(e.keyCode) === _hotkey(item.item)){
|
||||
e.preventDefault();
|
||||
$item.click();
|
||||
$item.trogger("click");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -203,8 +207,8 @@ function $MenuBar(menus){
|
|||
break;
|
||||
case 39: // Right
|
||||
if($focused_item.find(".menu-item-submenu-area:not(:empty)").length){
|
||||
$focused_item.click();
|
||||
$(".menu-popup .menu-item").first().focus();
|
||||
$focused_item.trigger("click");
|
||||
$(".menu-popup .menu-item")[0].focus(); // first item
|
||||
e.preventDefault();
|
||||
}else{
|
||||
$menu_container.next().find(".menu-button").trigger("pointerdown");
|
||||
|
@ -216,10 +220,10 @@ function $MenuBar(menus){
|
|||
while($next.length && !$next.is(".menu-item")){
|
||||
$next = $next.next();
|
||||
}
|
||||
$next.focus();
|
||||
$next[0].focus();
|
||||
}else{
|
||||
$menu_button.trigger("pointerdown");
|
||||
$menu_popup.find(".menu-item").first().focus();
|
||||
$menu_popup.find(".menu-item")[0].focus(); // first item
|
||||
}
|
||||
break;
|
||||
case 38: // Up
|
||||
|
@ -228,10 +232,10 @@ function $MenuBar(menus){
|
|||
while($prev.length && !$prev.is(".menu-item")){
|
||||
$prev = $prev.prev();
|
||||
}
|
||||
$prev.focus();
|
||||
$prev[0].focus();
|
||||
}else{
|
||||
$menu_button.trigger("pointerdown"); // or maybe do nothing?
|
||||
$menu_popup.find(".menu-item").last().focus();
|
||||
$menu_popup.find(".menu-item").last()[0].focus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -262,7 +266,7 @@ function $MenuBar(menus){
|
|||
|
||||
close_menus();
|
||||
|
||||
$menu_button.focus();
|
||||
$menu_button[0].focus();
|
||||
$menu_button.addClass("active");
|
||||
$menu_popup.show();
|
||||
$menu_popup.triggerHandler("update");
|
||||
|
|
|
@ -48,7 +48,7 @@ function $Window($component){
|
|||
case 39: // Right
|
||||
if($focused.is("button")){
|
||||
if(focused_index < $buttons.length - 1){
|
||||
$buttons.get(focused_index + 1).focus();
|
||||
$buttons[focused_index + 1].focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ function $Window($component){
|
|||
case 37: // Left
|
||||
if($focused.is("button")){
|
||||
if(focused_index > 0){
|
||||
$buttons.get(focused_index - 1).focus();
|
||||
$buttons[focused_index - 1].focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ function $FormWindow(title){
|
|||
});
|
||||
|
||||
$b.on("pointerdown", function(){
|
||||
$b.focus();
|
||||
$b[0].focus();
|
||||
});
|
||||
|
||||
return $b;
|
||||
|
|
|
@ -79,7 +79,7 @@ OnCanvasTextBox.prototype.instantiate = function(){
|
|||
// this doesn't need to be a seperate function
|
||||
|
||||
tb.$el.append(tb.$editor);
|
||||
tb.$editor.focus();
|
||||
tb.$editor[0].focus();
|
||||
|
||||
tb.$handles = $Handles(tb.$el, tb.$editor[0], {outset: 2});
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ function create_and_trigger_input(attrs, callback){
|
|||
})
|
||||
.appendTo($app)
|
||||
.hide()
|
||||
.click();
|
||||
.trigger("click");
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
@ -214,12 +214,12 @@ function file_load_from_url(){
|
|||
} else {
|
||||
show_error_message("Invalid URL. It must include a protocol (https:// or http://)");
|
||||
}
|
||||
}).focus();
|
||||
});
|
||||
$w.$Button("Cancel", function(){
|
||||
$w.close();
|
||||
});
|
||||
$w.center();
|
||||
$input.focus();
|
||||
$input[0].focus();
|
||||
}
|
||||
|
||||
function file_save(){
|
||||
|
@ -263,7 +263,7 @@ function are_you_sure(action, canceled){
|
|||
$w.close();
|
||||
file_save();
|
||||
action();
|
||||
}).focus();
|
||||
})[0].focus();
|
||||
$w.$Button("Discard", function(){
|
||||
$w.close();
|
||||
action();
|
||||
|
@ -390,7 +390,7 @@ function paste(img){
|
|||
do_the_paste();
|
||||
$canvas_area.trigger("resize");
|
||||
});
|
||||
}).focus();
|
||||
})[0].focus();
|
||||
$w.$Button("Crop", function(){
|
||||
$w.close();
|
||||
do_the_paste();
|
||||
|
@ -558,7 +558,7 @@ function undoable(callback, action){
|
|||
$w.close();
|
||||
redos = [];
|
||||
action && action();
|
||||
}).focus();
|
||||
})[0].focus();
|
||||
$w.$Button("Keep", function(){
|
||||
$w.close();
|
||||
});
|
||||
|
@ -1035,7 +1035,7 @@ function image_attributes(){
|
|||
$canvas.trigger("user-resized", [0, 0, ~~width, ~~height]);
|
||||
|
||||
image_attributes.$window.close();
|
||||
}).focus();
|
||||
})[0].focus();
|
||||
|
||||
$w.$Button("Cancel", function(){
|
||||
image_attributes.$window.close();
|
||||
|
@ -1083,7 +1083,10 @@ function image_flip_and_rotate(){
|
|||
|
||||
var $label = $(this).closest("label");
|
||||
// Focus the numerical input if this field has one
|
||||
$label.find("input[type='number']").focus();
|
||||
var num_input = $label.find("input[type='number']")[0];
|
||||
if (num_input) {
|
||||
num_input.focus();
|
||||
}
|
||||
// Select the radio for this field
|
||||
$label.find("input[type='radio']").prop("checked", true);
|
||||
});
|
||||
|
@ -1124,7 +1127,7 @@ function image_flip_and_rotate(){
|
|||
$canvas_area.trigger("resize");
|
||||
|
||||
$w.close();
|
||||
}).focus();
|
||||
})[0].focus();
|
||||
$w.$Button("Cancel", function(){
|
||||
$w.close();
|
||||
});
|
||||
|
@ -1173,7 +1176,7 @@ function image_stretch_and_skew(){
|
|||
stretch_and_skew(xscale, yscale, hskew, vskew);
|
||||
$canvas_area.trigger("resize");
|
||||
$w.close();
|
||||
}).focus();
|
||||
})[0].focus();
|
||||
|
||||
$w.$Button("Cancel", function(){
|
||||
$w.close();
|
||||
|
|
14
src/help.js
14
src/help.js
|
@ -18,11 +18,11 @@ function show_help(){
|
|||
$iframe.css({backgroundColor: "white"});
|
||||
$help_window.center();
|
||||
|
||||
var parse_object = function($object){
|
||||
// parse an $(<object>) to an object
|
||||
var parse_object_params = function($object){
|
||||
// parse an $(<object>) to a plain object of key value pairs
|
||||
var object = {};
|
||||
$object.children("param").each(function(i, param){
|
||||
object[$(param).attr("name")] = $(param).attr("value");
|
||||
object[param.name] = param.value;
|
||||
});
|
||||
return object;
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ function show_help(){
|
|||
};
|
||||
|
||||
var $default_item_li = $(E("li")).addClass("page");
|
||||
$default_item_li.append($Item("Welcome to Help").click(function(e){
|
||||
$default_item_li.append($Item("Welcome to Help").on("click", function(e){
|
||||
$iframe.attr({src: "help/default.html"});
|
||||
}));
|
||||
$contents.append($default_item_li);
|
||||
|
@ -57,7 +57,7 @@ function show_help(){
|
|||
$.get("help/mspaint.hhc", function(hhc){
|
||||
$($.parseHTML(hhc)).filter("ul").children().each(function(i, li){
|
||||
|
||||
var object = parse_object($(li).children("object"));
|
||||
var object = parse_object_params($(li).children("object"));
|
||||
|
||||
var $folder_li = $(E("li")).addClass("folder");
|
||||
$folder_li.append($Item(object.Name));
|
||||
|
@ -67,9 +67,9 @@ function show_help(){
|
|||
$folder_li.append($folder_items_ul);
|
||||
|
||||
$(li).children("ul").children().each(function(i, li){
|
||||
var object = parse_object($(li).children("object"));
|
||||
var object = parse_object_params($(li).children("object"));
|
||||
var $item_li = $(E("li")).addClass("page");
|
||||
$item_li.append($Item(object.Name).click(function(e){
|
||||
$item_li.append($Item(object.Name).on("click", function(e){
|
||||
$iframe.attr({src: "help/" + object.Local});
|
||||
}));
|
||||
$folder_items_ul.append($item_li);
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
// make jQuery play well with PEP
|
||||
$.event.props.push("button", "buttons", "clientX", "clientY", "offsetX", "offsetY", "pageX", "pageY", "screenX", "screenY", "toElement");
|
||||
$.event.props.push("pointerType", "pointerId", "width", "height", "pressure", "tiltX", "tiltY", "hwTimestamp", "isPrimary");
|
||||
|
||||
// configure Font Detective
|
||||
FontDetective.swf = "./lib/FontList.swf";
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ function manage_storage(){
|
|||
$(E("td")).append($open_link).appendTo($tr);
|
||||
$(E("td")).append($remove).appendTo($tr);
|
||||
|
||||
$remove.click(function(){
|
||||
$remove.on("click", function(){
|
||||
localStorage.removeItem(k);
|
||||
$tr.remove();
|
||||
if($table.find("tr").length == 0){
|
||||
|
|
|
@ -37,7 +37,7 @@ var ChooserCanvas = function(
|
|||
c.ctx.putImageData(id, 0, 0);
|
||||
}
|
||||
};
|
||||
$(img).load(render);
|
||||
$(img).on("load", render);
|
||||
render();
|
||||
return c;
|
||||
};
|
||||
|
|
2
test.js
2
test.js
|
@ -73,7 +73,7 @@ casper.test.begin('jspaint visual tests', function(test){
|
|||
);
|
||||
});
|
||||
// casper.thenEvaluate(function(selector){
|
||||
// $(selector).find(".window-close-button").click();
|
||||
// $(selector).find(".window-close-button").trigger("click");
|
||||
// }, selector);
|
||||
casper.then(function close_the_window(){
|
||||
casper.click(selector + " .window-close-button");
|
||||
|
|
Loading…
Reference in New Issue