Prevent default event on JavaScript-only links
These links point to "#" and don't do anything without JavaScript activated, and they were causing the browser to scroll to the top of the page.
This commit is contained in:
@@ -2,13 +2,17 @@
|
||||
"use strict";
|
||||
App.CheckAllNone = {
|
||||
initialize: function() {
|
||||
$("[data-check-all]").on("click", function() {
|
||||
$("[data-check-all]").on("click", function(e) {
|
||||
var target_name;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
target_name = $(this).data("check-all");
|
||||
$("[name='" + target_name + "']").prop("checked", true);
|
||||
});
|
||||
$("[data-check-none]").on("click", function() {
|
||||
$("[data-check-none]").on("click", function(e) {
|
||||
var target_name;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
target_name = $(this).data("check-none");
|
||||
$("[name='" + target_name + "']").prop("checked", false);
|
||||
});
|
||||
|
||||
@@ -17,10 +17,14 @@
|
||||
$("#user_password").prop("type", type);
|
||||
},
|
||||
initialize: function() {
|
||||
$(".generate-random-value").on("click", function() {
|
||||
$(".generate-random-value").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
$("#user_password").val(App.Managers.generatePassword());
|
||||
});
|
||||
$(".show-password").on("click", function() {
|
||||
$(".show-password").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if ($("#user_password").is("input[type='password']")) {
|
||||
App.Managers.togglePassword("text");
|
||||
} else {
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
editor.find("textarea").on("scroll", function() {
|
||||
editor.find(".markdown-preview").scrollTop($(this).scrollTop());
|
||||
});
|
||||
editor.find(".fullscreen-toggle").on("click", function() {
|
||||
editor.find(".fullscreen-toggle").on("click", function(e) {
|
||||
var span;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
editor.toggleClass("fullscreen");
|
||||
$(".fullscreen-container").toggleClass("medium-8", "medium-12");
|
||||
span = $(this).find("span");
|
||||
|
||||
Reference in New Issue
Block a user