Mobile Friendly Userscript Selection

Mobile Friendly Userscript Selection
This commit is contained in:
henk717 2022-06-06 19:01:12 +02:00 committed by GitHub
commit 9bf4db2a7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View File

@ -106,6 +106,9 @@ var using_webkit_patch = true;
var shift_down = false; var shift_down = false;
var do_clear_ent = false; var do_clear_ent = false;
// Whether or not an entry in the Userscripts menu is being dragged
var us_dragging = false;
// Display vars // Display vars
var allowtoggle = false; var allowtoggle = false;
var formatcount = 0; var formatcount = 0;
@ -2412,9 +2415,25 @@ $(document).ready(function(){
}, 2); }, 2);
}); });
var us_click_handler = function(ev) {
setTimeout(function() {
if (us_dragging) {
return;
}
var target = $(ev.target).closest(".uslistitem")[0];
if ($.contains(document.getElementById("uslistunloaded"), target)) {
document.getElementById("uslistloaded").appendChild(target);
} else {
document.getElementById("uslistunloaded").appendChild(target);
}
}, 10);
}
// Make the userscripts menu sortable // Make the userscripts menu sortable
var us_sortable_settings = { var us_sortable_settings = {
placeholder: "ussortable-placeholder", placeholder: "ussortable-placeholder",
start: function() { us_dragging = true; },
stop: function() { us_dragging = false; },
delay: 2, delay: 2,
cursor: "move", cursor: "move",
tolerance: "pointer", tolerance: "pointer",
@ -2423,12 +2442,12 @@ $(document).ready(function(){
scrollSensitivity: 64, scrollSensitivity: 64,
scrollSpeed: 10, scrollSpeed: 10,
} }
$(usunloaded).sortable($.extend({ usunloaded.sortable($.extend({
connectWith: "#uslistloaded", connectWith: "#uslistloaded",
}, us_sortable_settings)); }, us_sortable_settings)).on("click", ".uslistitem", us_click_handler);
$(usloaded).sortable($.extend({ usloaded.sortable($.extend({
connectWith: "#uslistunloaded", connectWith: "#uslistunloaded",
}, us_sortable_settings)); }, us_sortable_settings)).on("click", ".uslistitem", us_click_handler);
// Bind actions to UI buttons // Bind actions to UI buttons
button_send.on("click", function(ev) { button_send.on("click", function(ev) {

View File

@ -17,7 +17,7 @@
<script src="static/bootstrap.min.js"></script> <script src="static/bootstrap.min.js"></script>
<script src="static/bootstrap-toggle.min.js"></script> <script src="static/bootstrap-toggle.min.js"></script>
<script src="static/rangy-core.min.js"></script> <script src="static/rangy-core.min.js"></script>
<script src="static/application.js?ver=1.18b"></script> <script src="static/application.js?ver=1.18c"></script>
</head> </head>
<body> <body>
<input type="file" id="remote-save-select" accept="application/json" style="display:none"> <input type="file" id="remote-save-select" accept="application/json" style="display:none">