PHP Classes

File: WICore/WIJ/WICore.js

Recommend this page to a friend!
  Classes of Jules Warner   WICMS   WICore/WIJ/WICore.js   Download  
File: WICore/WIJ/WICore.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: WICMS
Database driven content management system with PDO
Author: By
Last change:
Date: 7 years ago
Size: 1,845 bytes
 

Contents

Class file image Download
/// WICore NAMESPACe var WICore = {}; // put the button into loading state WICore.loadingButton = function(button, LoadingText) { oldText = button.text(); button.attr("rel", oldText) .text(LoadingText) .addClass("disabled") .attr('disabled', "disabled"); }; // this returns the button back to normal state WICore.removeLoadingButton = function (button) { var oldText = button.attr('rel'); button.text(oldText) .removeClass("disabled") .removeAttr("disabled") .removeAttr("rel"); }; // append the success message to provided parent client WICore.displaySuccessMessage = function(parentElement, message) { $(".alert-success").remove(); var div = ("<div class='alert alert-success'>"+message+"</div>"); parentElement.append(div); }; // append error message to an input element WICore.displayErrorMessage = function(element, message) { var controlGroup = element.parents(".control-group"); controlGroup.addClass("error").addClass("has-error"); if(typeof message !== "undefined") { var helpBlock = $("<span class='help-inline text-error'>"+message+"</span>"); controlGroup.find(".controls").append(helpBlock); } }; // remove all error messages from all input fields WICore.removeErrorMessages = function() { $(".control-group").removeClass("error").removeClass("has-error"); $(".help-inline").remove(); }; // validate email format WICore.validateEmail = function (email) { var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; return regex.test(email); }; //get a parameter from the url WICore.urlParam = function(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null; };