mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 06:59:20 +00:00
refactored web / all-app now linked in app. no wnframework in website
This commit is contained in:
45
public/js/website_utils.js
Normal file
45
public/js/website_utils.js
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
var erpnext = {};
|
||||
|
||||
// subject, sender, description
|
||||
erpnext.send_message = function(opts) {
|
||||
if(opts.btn) {
|
||||
$(opts.btn).attr("disabled", "disabled");
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "server.py",
|
||||
data: {
|
||||
cmd: "website.send_message",
|
||||
subject: opts.subject,
|
||||
sender: opts.sender,
|
||||
message: typeof opts.message == "string"
|
||||
? opts.message
|
||||
: JSON.stringify(opts.message)
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(opts.btn) {
|
||||
$(opts.btn).attr("disabled", false);
|
||||
}
|
||||
if(opts.callback)
|
||||
opts.callback(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function valid_email(id) {
|
||||
if(id.toLowerCase().search("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")==-1)
|
||||
return 0; else return 1; }
|
||||
|
||||
function get_url_arg(name) {
|
||||
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
||||
var regexS = "[\\?&]"+name+"=([^&#]*)";
|
||||
var regex = new RegExp( regexS );
|
||||
var results = regex.exec( window.location.href );
|
||||
if(results == null)
|
||||
return "";
|
||||
else
|
||||
return decodeURIComponent(results[1]);
|
||||
}
|
||||
Reference in New Issue
Block a user