mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Updated the base JS (file) to use jQuery instead of $ across the board
--HG-- branch : dev
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//todo: (heskew) make use of the autofocus attribute instead
|
//todo: (heskew) make use of the autofocus attribute instead
|
||||||
jQuery.fn.extend({
|
jQuery.fn.extend({
|
||||||
helpfullyFocus: function() {
|
helpfullyFocus: function() {
|
||||||
var _this = $(this);
|
var _this = jQuery(this);
|
||||||
var firstError = _this.find(".input-validation-error").first();
|
var firstError = _this.find(".input-validation-error").first();
|
||||||
// try to focus the first error on the page
|
// try to focus the first error on the page
|
||||||
if (firstError.size() === 1) {
|
if (firstError.size() === 1) {
|
||||||
@@ -16,12 +16,12 @@ jQuery.fn.extend({
|
|||||||
return autofocus.focus();
|
return autofocus.focus();
|
||||||
},
|
},
|
||||||
toggleWhatYouControl: function() {
|
toggleWhatYouControl: function() {
|
||||||
var _this = $(this);
|
var _this = jQuery(this);
|
||||||
var _controllees = $("[data-controllerid=" + _this.attr("id") + "]");
|
var _controllees = jQuery("[data-controllerid=" + _this.attr("id") + "]");
|
||||||
var _controlleesAreHidden = _controllees.is(":hidden");
|
var _controlleesAreHidden = _controllees.is(":hidden");
|
||||||
if (_this.is(":checked") && _controlleesAreHidden) {
|
if (_this.is(":checked") && _controlleesAreHidden) {
|
||||||
_controllees.hide(); // <- unhook this when the following comment applies
|
_controllees.hide(); // <- unhook this when the following comment applies
|
||||||
$(_controllees.show()[0]).find("input").focus(); // <- aaaand a slideDown there...eventually
|
jQuery(_controllees.show()[0]).find("input").focus(); // <- aaaand a slideDown there...eventually
|
||||||
} else if (!(_this.is(":checked") && _controlleesAreHidden)) {
|
} else if (!(_this.is(":checked") && _controlleesAreHidden)) {
|
||||||
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less
|
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less
|
||||||
_controllees.hide()
|
_controllees.hide()
|
||||||
@@ -30,27 +30,27 @@ jQuery.fn.extend({
|
|||||||
});
|
});
|
||||||
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
||||||
(function() {
|
(function() {
|
||||||
$("[data-controllerid]").each(function() {
|
jQuery("[data-controllerid]").each(function() {
|
||||||
var controller = $("#" + $(this).attr("data-controllerid"));
|
var controller = jQuery("#" + jQuery(this).attr("data-controllerid"));
|
||||||
if (controller.data("isControlling")) {
|
if (controller.data("isControlling")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
controller.data("isControlling", 1);
|
controller.data("isControlling", 1);
|
||||||
if (!controller.is(":checked")) {
|
if (!controller.is(":checked")) {
|
||||||
$("[data-controllerid=" + controller.attr("id") + "]").hide();
|
jQuery("[data-controllerid=" + controller.attr("id") + "]").hide();
|
||||||
}
|
}
|
||||||
if (controller.is(":checkbox")) {
|
if (controller.is(":checkbox")) {
|
||||||
controller.click($(this).toggleWhatYouControl);
|
controller.click(jQuery(this).toggleWhatYouControl);
|
||||||
} else if (controller.is(":radio")) {
|
} else if (controller.is(":radio")) {
|
||||||
$("[name=" + controller.attr("name") + "]").click(function() { $("[name=" + $(this).attr("name") + "]").each($(this).toggleWhatYouControl); });
|
jQuery("[name=" + controller.attr("name") + "]").click(function() { jQuery("[name=" + jQuery(this).attr("name") + "]").each(jQuery(this).toggleWhatYouControl); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
// inline form link buttons (form.inline.link button) swapped out for a link that submits said form
|
// inline form link buttons (form.inline.link button) swapped out for a link that submits said form
|
||||||
(function() {
|
(function() {
|
||||||
$("form.inline.link").each(function() {
|
jQuery("form.inline.link").each(function() {
|
||||||
var _this = $(this);
|
var _this = jQuery(this);
|
||||||
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
var link = jQuery("<a class='wasFormInlineLink' href='.'/>");
|
||||||
var button = _this.children("button").first();
|
var button = _this.children("button").first();
|
||||||
link.text(button.text())
|
link.text(button.text())
|
||||||
.addClass(button.attr("class"))
|
.addClass(button.attr("class"))
|
||||||
@@ -58,10 +58,10 @@ jQuery.fn.extend({
|
|||||||
.unload(function() { _this = 0; });
|
.unload(function() { _this = 0; });
|
||||||
_this.replaceWith(link);
|
_this.replaceWith(link);
|
||||||
_this.css({ "position": "absolute", "left": "-9999em" });
|
_this.css({ "position": "absolute", "left": "-9999em" });
|
||||||
$("body").append(_this);
|
jQuery("body").append(_this);
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
// a little better autofocus
|
// a little better autofocus
|
||||||
$(function() {
|
jQuery(function() {
|
||||||
$("body").helpfullyFocus();
|
jQuery("body").helpfullyFocus();
|
||||||
});
|
});
|
Reference in New Issue
Block a user