-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjavascript.js
More file actions
61 lines (50 loc) · 1.6 KB
/
Copy pathjavascript.js
File metadata and controls
61 lines (50 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var utopia = utopia ? utopia : {};
utopia.Initialise = {
_functs: [],
add: function (f) {
if ($.inArray(f,this._functs) > -1) return;
this._functs.push(f);
},
run: function () {
for (f in this._functs) {
this._functs[f]();
}
}
}
utopia.RedrawField = function(selector,encVal) {
$sel = $(selector);
var curval = $sel.html(),
newval = Base64.decode(encVal);
if (curval == newval) return;
$sel.html(newval);
}
$(function(){utopia.Initialise.run();});
$(document).ajaxComplete(function() {utopia.Initialise.run();});
jQuery.fn.ajaxFileUpload = function(settings) {
afuFinished = function() {
data = jQuery(this).contents().find("body").html();
if (settings.success)
settings.success(data);
$(iFrame).remove();
$(form).remove();
}
var frameID = 'submitForm_'+(new Date()).getTime();
var iFrame = jQuery('<iframe style="display:none" id="'+frameID+'" name="'+frameID+'"></iframe>').appendTo('body');
iFrame.load(afuFinished);
extras = '';
for (key in settings.data) extras += '<input type="hidden" name="'+key+'" value="'+settings.data[key]+'">';
var form = jQuery('<form style="display:none" action="'+settings.url+'" target="'+frameID+'" method="post" enctype="multipart/form-data">'+extras+'</form>').appendTo('body');
this.each(function () {
jQuery(this).appendTo(form);
});
form.submit();
};
function getParameterByName(name,querystring) {
if (!querystring) querystring = window.location.search;
var match = RegExp('[?&]' + name + '=([^&#]*)')
.exec(querystring);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
function ErrorLog(text) {
alert(text);
}