1
0
mirror of https://github.com/fcwu/docker-ubuntu-vnc-desktop synced 2026-08-05 16:12:41 +02:00

Update noVNC

This commit is contained in:
Doro Wu
2015-05-12 19:04:00 +08:00
parent fc314ed81c
commit 602ac45102
312 changed files with 43548 additions and 2338 deletions
+121
View File
@@ -0,0 +1,121 @@
function QFlot(bodyObjID)
{
this.bodyObjID = bodyObjID;
this.DataArray = [];
this.PreviousData = [];
this.totalPoints = 180; // 180*5s=15min
//public methods
QFlot.prototype.InsertData = InsertData;
QFlot.prototype.Repaint = Repaint;
QFlot.prototype.GetData = GetData;
// private constructor
__construct = function(that) {
}(this)
function GetData(idx) {
var maxValue = 0;
var result = [];
var rxData = [];
var txData = [];
for (var i=0; i<this.totalPoints-this.DataArray[idx].rx.length; i++) {
rxData.push([i, 0]);
txData.push([i, 0]);
}
for (var i=0; i<this.DataArray[idx].rx.length; i++) {
rxData.push([rxData.length, this.DataArray[idx].rx[i]]);
txData.push([txData.length, this.DataArray[idx].tx[i]]);
}
var tmpMax = Math.max.apply(Math, this.DataArray[idx].rx);
if (maxValue < tmpMax) {
maxValue = tmpMax;
}
tmpMax = Math.max.apply(Math, this.DataArray[idx].tx);
if (maxValue < tmpMax) {
maxValue = tmpMax;
}
result.push({label: gettext('Packets received'), data: rxData});
result.push({label: gettext('Packets sent'), data: txData});
return {'maxValue':maxValue, 'result':result};
}
function InsertData(bridge_name, rx, tx) {
if (this.DataArray.length == 0) {
this.DataArray.push({'bridge_name':bridge_name, 'rx':[rx/(1024*5)], 'tx':[tx/(1024*5)]});
return;
}
for (var i=0; i<this.DataArray.length; i++) {
if (this.DataArray[i].bridge_name == bridge_name) {
this.DataArray[i].rx.push(rx/(1024*5)); // kb/s
this.DataArray[i].tx.push(tx/(1024*5));
if (this.DataArray[i].rx.length > this.totalPoints) {
this.DataArray[i].rx.shift();
this.DataArray[i].tx.shift();
}
break;
}
}
}
function Repaint() {
var resultData = this.GetData(0);
var maxValue = resultData.maxValue/0.9;
if (maxValue < 400) {
maxValue = 400;
}
var myTicksX = [];
for (var i=0; i<=5; i++) {
var xValue = this.totalPoints/5*i;
if(i == 5) {
myTicksX.push([xValue, String((this.totalPoints-xValue)/12)+' MINs']);
}
else {
myTicksX.push([xValue, String((this.totalPoints-xValue)/12)]);
}
}
var myTicksY = [[0, '0KB/s']];
for (var i=1; i<5; i++) {
var yValue = maxValue/4*i;
if (yValue >= 1024*1024) {
myTicksY.push([yValue, (yValue/1024/1024).toFixed(0) + 'GB']);
} else if (yValue >= 1024) {
myTicksY.push([yValue, (yValue/1024).toFixed(0) + 'MB']);
} else {
myTicksY.push([yValue, yValue.toFixed(0) + 'KB']);
}
}
var plot = $.plot($('#'+this.bodyObjID),
resultData.result,
{
colors: ["#5E4D93" , "#FCCD06"],
legend: {
container:$("#legendContainer"),
//position: 'nw',
labelBoxBorderColor: "#FFFFFF"
//noColumns: 0
},
xaxis: {
min: 0,
max: this.totalPoints,
ticks: myTicksX
},
yaxis: {
min: 0,
max: maxValue,
ticks: myTicksY
},
grid:{ backgroundColor: { colors: ["#ffffff", "#ffffff"] } }
}
);
plot.draw();
}
}
+227
View File
@@ -0,0 +1,227 @@
var gNodeIdCount = 100;
DEFAULT_POOL_FOLDER_ID = "";
MODE_SINGLE_FOLDER = 1;
MODE_SINGLE_FILE = 2;
FILTER_FOLDER = 'folder';
FILTER_EXPORT = 'export';
FILTER_ISO = 'iso';
FILTER_IMG = 'img';
function QFolderTree(mode, filter)
{
//public methods
QFolderTree.prototype.initTree = initTree;
QFolderTree.prototype.destroy = destroy;
QFolderTree.prototype.expandAll = expandAll;
QFolderTree.prototype.collapseAll = collapseAll;
QFolderTree.prototype.onItemlClick = onItemlClick;
QFolderTree.prototype.getItemInfo = getItemInfo;
QFolderTree.prototype.selectFolder = selectFolder;
this.FolderList = [];
this.FocusID = "";
this.Mode = mode ? mode : MODE_SINGLE_FOLDER;
this.Filter = filter ? filter : FILTER_FOLDER;
this.bInit = false;
this.BodyObgID = '';
this.argDefaultFolders = [];
this.bAutoSelect = false;
var idTreeViewRoot = 'treeviewroot';
var idTreeViewControl = 'treeviewcontrol';
var idTreeViewCollapse = 'treeviewcollapse';
var idTreeViewExpand = 'treeviewexpand';
function initTree(bodyObjID, shareList, rootName) {
gNodeIdCount = 100;
this.FolderList = shareList;
this.BodyObgID = bodyObjID;
var tmpStr = '<div id="'+idTreeViewControl+'"><a href="?#" id="'+idTreeViewCollapse+'">Collapse All</a> | <a href="?#" id="'+idTreeViewExpand+'">Expand All</a></div>' +
'<ul id="'+idTreeViewRoot+'" class="filetree treeview-famfamfam">'+
'<li><span id="node_'+(gNodeIdCount++)+'" class="folder" style="background-image: url(\'../../../media/img/treeview/nas.png\');background-position:0 3px;padding-left:22px;">'+rootName+'</span><ul>';
for (var i=0; i<this.FolderList.length; i++) {
this.FolderList[i].id = 'node_' + gNodeIdCount;
if (this.FolderList[i].name == 'Public') {
this.FocusID = this.FolderList[i].id;
DEFAULT_POOL_FOLDER_ID = this.FolderList[i].id;
}
tmpStr += '<li><span id="node_'+gNodeIdCount+'" class="'+this.FolderList[i].type+'">'+this.FolderList[i].name+'</span><ul id="root_node_'+(gNodeIdCount++)+'" style="display:none;"></ul></li>';
}
tmpStr += '</ul></li></ul>';
document.getElementById(bodyObjID).innerHTML = tmpStr;
var parentElm = this;
$('#'+idTreeViewRoot).treeview({
control:'#'+idTreeViewControl,
toggle: function() {
var elemID = $(this).find(">span").attr('id');
if (!parentElm.bInit || elemID == 'node_100') {
return false;
}
parentElm.onItemlClick(elemID);
}
});
this.collapseAll();
this.bInit = true;
}
function destroy() {
if (this.BodyObgID) {
document.getElementById(this.BodyObgID).innerHTML = '';
}
this.FolderList = [];
}
function expandAll() {
document.getElementById(idTreeViewExpand).click();
}
function collapseAll() {
document.getElementById(idTreeViewCollapse).click();
document.getElementById('node_100').click();
}
function getItemInfo(elemID) {
var item = null;
for (var i=0; i<this.FolderList.length; i++) {
if (this.FolderList[i].id == elemID) {
item = this.FolderList[i];
break;
}
}
return item;
}
function onItemlClick(elemID) {
var item = this.getItemInfo(elemID);
if (!item) {
return;
}
if (item.type == 'file') {
UpdateFocusFile(item.id); // implement by owner page
} else {
UpdateFocusFolder(item.id); // implement by owner page
}
if (item.load || (item.type != 'folder')) {
return;
}
var url = "/folderlist/?path=" + item.fullpath + "&filter=" + this.Filter + "&id=" + item.id;
makeRequest(url, '', _callbk_load_folder_list, this);
}
function selectFolder(folders) {
if (folders.length < 2) {
return;
}
this.argDefaultFolders = folders
this.bAutoSelect = true;
var find_cnt = 0;
var cur_path = '/' + folders[0] + '/' + folders[1] + '/';
for (var t=2;t<folders.length;t++) {
cur_path += folders[t] + '/';
for (var i=0; i<this.FolderList.length; i++) {
if (this.FolderList[i].fullpath == cur_path) {
find_cnt = t;
if (!this.FolderList[i].load) {
document.getElementById(this.FolderList[i].id).click();
}
break;
}
}
}
if (find_cnt == (folders.length-1)) {
this.bAutoSelect = false;
}
}
}
function _callbk_load_folder_list(http_request, objTree)
{
if (http_request.readyState == 4) {
if (http_request.status == 200) {
var json = JSON.parse(http_request.responseText);
if (!json.success) {
window.location.href = window.location.href
return;
}
var item = null;
for (var i=0; i<objTree.FolderList.length; i++) {
if (objTree.FolderList[i].id == json.id) {
objTree.FolderList[i].load = true;
item = objTree.FolderList[i];
break;
}
}
if (!item) {
return;
}
var tmpStr = '';
// list folder items
for (var i=0; i<json.list_data.length; i++) {
if (json.list_data[i].type != 'folder') {
continue;
}
var newItem = json.list_data[i];
newItem.id = 'node_' + gNodeIdCount;
FileFolderTree.FolderList.push(newItem);
tmpStr += '<li><span id="node_'+gNodeIdCount+'" class="'+newItem.type+'">'+newItem.name+'</span><ul id="root_node_'+gNodeIdCount+'" style="display:none;"></ul></li>';
gNodeIdCount++;
}
// list file items
for (var i=0; i<json.list_data.length; i++) {
if (json.list_data[i].type != 'file') {
continue;
}
var newItem = json.list_data[i];
newItem.id = 'node_' + gNodeIdCount;
FileFolderTree.FolderList.push(newItem);
tmpStr += '<li><span id="node_'+gNodeIdCount+'" class="'+newItem.type+'" onclick="UpdateFocusFile(this.id)">'+newItem.name+'</span></li>';
gNodeIdCount++;
}
var branches = $(tmpStr).appendTo("#root_"+json.id);
$("#root_"+json.id).treeview({
add: branches
});
if (objTree.bAutoSelect) {
objTree.selectFolder(objTree.argDefaultFolders);
}
}
}
}
function GetShareShortPath(shareMap, fullpath)
{
var strRet = fullpath;
for (var i=0; i<shareMap.length; i++) {
if (fullpath.indexOf(shareMap[i].fullpath) == 0) {
strRet = fullpath.replace(shareMap[i].fullpath, shareMap[i].shortpath + '/');
break;
}
}
return strRet;
}
+197
View File
@@ -0,0 +1,197 @@
function QSpinEdit(EditId, minValue, maxValue)
{
//properties
this.EditId = EditId;//deprecated
this.ObjectRef = [];
this.ObjectId = [];
this.ObjectId['Edit'] = EditId;
this.ObjectId['UpArrow'] = "up"+EditId;
this.ObjectId['DownArrow'] = "down"+EditId;
this.DefaultValue = minValue;
this.MinValue = minValue;
this.MaxValue = maxValue;
this.Size = 2; //no effect after WriteControl
this.BackgroundColor = 'white';
this.Style = 'vert'; //no effect after WriteControl
this.ReadOnly = false; //read-only property
this.TimerObj = null;
this.Step = -1;
//public methods
QSpinEdit.prototype.AddSubStep = AddSubStep;
QSpinEdit.prototype.WriteControl = WriteControl;
QSpinEdit.prototype.GetValue = GetValue;
QSpinEdit.prototype.SetValue = SetValue;
QSpinEdit.prototype.Validate = Validate;
QSpinEdit.prototype.Disable = Disable;
QSpinEdit.prototype.Enable = Enable;
QSpinEdit.prototype.ResetValue = ResetValue;
//internal event handlers; there is not need to call them directly
QSpinEdit.prototype.HandleChange = HandleChange;
//private function members
var FixJSFloatBug = function FixJSFloatBug(n){return Math.round(n*100)/100;}
//events
QSpinEdit.prototype.OnChange = function OnChange(){};
QSpinEdit.prototype.OnValidateError = function OnValidateError(){};
//-----------------------------------------------------------------
function Validate(theValue)
{
if (theValue === '' || theValue == null || theValue > this.MaxValue || theValue < this.MinValue || isFinite(theValue) == 0 || String(FixJSFloatBug(theValue)).indexOf('.') !=- 1) {
this.OnValidateError();
return false;
} else {
//prevent bug when user enters '07' for example in the edit field
this.ObjectRef['Edit'].value = FixJSFloatBug(theValue*1); //little trick to convert to numeric and prevent JS Floating point operation bugs
return true;
}
}
function AddSubStep(mode)
{
if (this.TimerObj) {
clearTimeout(this.TimerObj);
}
if (this.ObjectRef['Edit'].disabled) {
return;
}
var OldValue = this.n;
if (this.Step > 0) {
this.n = FixJSFloatBug((mode == "add") ? this.n+this.Step : this.n-this.Step);
if (this.n < this.MinValue) {
this.n = this.MinValue;
} else if (this.n > this.MaxValue) {
this.n = this.MaxValue;
}
} else {
var i = 0;
for (i=0; i<=5; i++) {
var tmp = Math.pow(2, i)*10; //10,20,40,80,160
if (this.n == tmp) {
this.n = FixJSFloatBug((mode == "add") ? tmp*2 : tmp/2);
if (this.n < 10) {
this.n = FixJSFloatBug(10);
} else if (this.n > 320) {
this.n = FixJSFloatBug(320);
}
break;
} else if (this.n < tmp) {
if ((tmp == 10) && (mode == "sub")) {
this.n = FixJSFloatBug(this.MinValue);
} else {
this.n = FixJSFloatBug((mode == "add") ? tmp : tmp/2);
}
break;
}
}
}
if (this.n != OldValue) {
this.ObjectRef['Edit'].value = this.n;
this.OnChange();
}
var myObj = this;
this.TimerObj = setTimeout(function(){myObj.AddSubStep(mode)}, 200);
}
function WriteControl(SpinName)
{
this.n = this.DefaultValue;
var readonly_str = '';
if (this.ReadOnly) {
readonly_str = 'readonly="readonly"';
}
document.write('<table border="0" summary="" cellspacing="0" cellpadding="0" style="display:inline;vertical-align:middle">');
document.write('<tr>');
if(this.Style == "vert") {
document.write('<td rowspan="2"><input style="width:100%;height:24px;" size="'+this.Size+'" id="'+this.ObjectId['Edit']+'" name="'+this.ObjectId['Edit']+'" type="text" value="'+this.DefaultValue+'" onchange="'+SpinName+'.HandleChange(false)" onkeyup="'+SpinName+'.HandleChange(true)" '+readonly_str+' /></td>');
document.write('<td width="50px"><div class="_bullet_arrow_up" style="margin:-5px 0 0 10px;"><input type="button" style="font-size:8px;color:black;width:16px;height:14px;vertical-align:bottom;padding:0px;" id="'+this.ObjectId['UpArrow']+'" onmousedown="this.blur();'+SpinName+'.AddSubStep(\'add\')" onmouseup="clearTimeout('+SpinName+'.TimerObj);" /></div></td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td width="50px"><div class="_bullet_arrow_down" style="margin:-3px 0 0 10px;"><input type="button" style="font-size:8px;color:black;width:16px;height:14px;vertical-align:top;padding:0px;" id="'+this.ObjectId['DownArrow']+'" onmousedown="this.blur();'+SpinName+'.AddSubStep(\'sub\')" onmouseup="clearTimeout('+SpinName+'.TimerObj);" /></div></td>');
} else { //horizontal
document.write('<td rowspan="2"><input style="width:100%;height:24px;" <input size="'+this.Size+'" id="'+this.ObjectId['Edit']+'" name="'+this.ObjectId['Edit']+'" type="text" value="'+this.DefaultValue+'" onchange="'+SpinName+'.HandleChange(false)" onkeyup="'+SpinName+'.HandleChange(true)" '+readonly_str+' /></td>');
document.write('<td width="50px"><div class="_bullet_arrow_up" style="margin:-5px 0 0 10px;"><input type="button" style="font-size:11px;color:black;width:18px;height:24px;padding:0px;" id="'+this.ObjectId['UpArrow']+'" onmousedown="this.blur();'+SpinName+'.AddSubStep(\'add\')" onmouseup="clearTimeout('+SpinName+'.TimerObj);" /></div></td>');
document.write('<td width="50px"><div class="_bullet_arrow_down" style="margin:-5px 0 0 10px;"><input type="button" style="font-size:11px;color:black;width:18px;height:24px;padding:0px;" id="'+this.ObjectId['DownArrow']+'" onmousedown="this.blur();'+SpinName+'.AddSubStep(\'sub\')" onmouseup="clearTimeout('+SpinName+'.TimerObj);" /></div></td>');
}
document.write('</tr>');
document.write('</table>');
//store objects references for faster access
this.ObjectRef['Edit'] = document.getElementById(this.ObjectId['Edit']);
this.ObjectRef['UpArrow'] = document.getElementById(this.ObjectId['UpArrow']);
this.ObjectRef['DownArrow'] = document.getElementById(this.ObjectId['DownArrow']);
}
//-----------------------------------------------------------------
//GetValue
function GetValue()
{
return this.n;
}
//-----------------------------------------------------------------
//SetValue
function SetValue(newValue)
{
//validation
if (!this.Validate(newValue) || this.ObjectRef['Edit'].disabled) {
return false;
}
this.n = newValue * 1;
this.ObjectRef['Edit'].value = this.n;
this.OnChange();
}
//-----------------------------------------------------------------
//ResetValue
function ResetValue()
{
this.n = this.DefaultValue;
this.ObjectRef['Edit'].value = this.n;
this.OnChange();
}
//-----------------------------------------------------------------
function HandleChange(bFromKey)
{
this.ObjectRef['Edit'].style.backgroundColor = this.BackgroundColor;
if (!this.Validate(this.ObjectRef['Edit'].value)) {
if (!bFromKey) {
this.ObjectRef['Edit'].value = this.n;
} else {
this.ObjectRef['Edit'].style.backgroundColor = 'yellow';
}
this.ObjectRef['Edit'].focus(); //set focus warn user
return false;
} else {
this.ObjectRef['Edit'].style.backgroundColor = 'white';
this.n = FixJSFloatBug(this.ObjectRef['Edit'].value*1); //little trick to convert to numeric and prevent JS Floating point operation bugs
}
this.OnChange();
return true;
}
//-----------------------------------------------------------------
function Disable()
{
this.ObjectRef['Edit'].disabled = true;
this.ObjectRef['UpArrow'].disabled = true;
this.ObjectRef['DownArrow'].disabled = true;
}
//-----------------------------------------------------------------
function Enable()
{
this.ObjectRef['Edit'].disabled = false;
this.ObjectRef['UpArrow'].disabled = false;
this.ObjectRef['DownArrow'].disabled = false;
}
}
+1182
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
+94
View File
@@ -0,0 +1,94 @@
/* ==========================================================
* bootstrap-alert.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function( $ ){
"use strict"
/* ALERT CLASS DEFINITION
* ====================== */
var dismiss = '[data-dismiss="alert"]'
, Alert = function ( el ) {
$(el).on('click', dismiss, this.close)
}
Alert.prototype = {
constructor: Alert
, close: function ( e ) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
$parent.trigger('close')
e && e.preventDefault()
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
$parent
.trigger('close')
.removeClass('in')
function removeElement() {
$parent
.trigger('closed')
.remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
}
}
/* ALERT PLUGIN DEFINITION
* ======================= */
$.fn.alert = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('alert')
if (!data) $this.data('alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.alert.Constructor = Alert
/* ALERT DATA-API
* ============== */
$(function () {
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
})
}( window.jQuery );
+100
View File
@@ -0,0 +1,100 @@
/* ============================================================
* bootstrap-button.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function( $ ){
"use strict"
/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */
var Button = function ( element, options ) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype = {
constructor: Button
, setState: function ( state ) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
$el[val](data[state] || this.options[state])
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
, toggle: function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
$.fn.button = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
, options = typeof option == 'object' && option
if (!data) $this.data('button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
$.fn.button.defaults = {
loadingText: 'loading...'
}
$.fn.button.Constructor = Button
/* BUTTON DATA-API
* =============== */
$(function () {
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
})
})
}( window.jQuery );
+161
View File
@@ -0,0 +1,161 @@
/* ==========================================================
* bootstrap-carousel.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#carousel
* ==========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function( $ ){
"use strict"
/* CAROUSEL CLASS DEFINITION
* ========================= */
var Carousel = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.carousel.defaults, options)
this.options.slide && this.slide(this.options.slide)
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
}
Carousel.prototype = {
cycle: function () {
this.interval = setInterval($.proxy(this.next, this), this.options.interval)
return this
}
, to: function (pos) {
var $active = this.$element.find('.active')
, children = $active.parent().children()
, activePos = children.index($active)
, that = this
if (pos > (children.length - 1) || pos < 0) return
if (this.sliding) {
return this.$element.one('slid', function () {
that.to(pos)
})
}
if (activePos == pos) {
return this.pause().cycle()
}
return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
}
, pause: function () {
clearInterval(this.interval)
this.interval = null
return this
}
, next: function () {
if (this.sliding) return
return this.slide('next')
}
, prev: function () {
if (this.sliding) return
return this.slide('prev')
}
, slide: function (type, next) {
var $active = this.$element.find('.active')
, $next = next || $active[type]()
, isCycling = this.interval
, direction = type == 'next' ? 'left' : 'right'
, fallback = type == 'next' ? 'first' : 'last'
, that = this
this.sliding = true
isCycling && this.pause()
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
if ($next.hasClass('active')) return
if (!$.support.transition && this.$element.hasClass('slide')) {
this.$element.trigger('slide')
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger('slid')
} else {
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
this.$element.trigger('slide')
this.$element.one($.support.transition.end, function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () { that.$element.trigger('slid') }, 0)
})
}
isCycling && this.cycle()
return this
}
}
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
$.fn.carousel = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('carousel')
, options = typeof option == 'object' && option
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (typeof option == 'string' || (option = options.slide)) data[option]()
else data.cycle()
})
}
$.fn.carousel.defaults = {
interval: 5000
, pause: 'hover'
}
$.fn.carousel.Constructor = Carousel
/* CAROUSEL DATA-API
* ================= */
$(function () {
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
$target.carousel(options)
e.preventDefault()
})
})
}( window.jQuery );
+138
View File
@@ -0,0 +1,138 @@
/* =============================================================
* bootstrap-collapse.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#collapse
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function( $ ){
"use strict"
var Collapse = function ( element, options ) {
this.$element = $(element)
this.options = $.extend({}, $.fn.collapse.defaults, options)
if (this.options["parent"]) {
this.$parent = $(this.options["parent"])
}
this.options.toggle && this.toggle()
}
Collapse.prototype = {
constructor: Collapse
, dimension: function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
, show: function () {
var dimension = this.dimension()
, scroll = $.camelCase(['scroll', dimension].join('-'))
, actives = this.$parent && this.$parent.find('.in')
, hasData
if (actives && actives.length) {
hasData = actives.data('collapse')
actives.collapse('hide')
hasData || actives.data('collapse', null)
}
this.$element[dimension](0)
this.transition('addClass', 'show', 'shown')
this.$element[dimension](this.$element[0][scroll])
}
, hide: function () {
var dimension = this.dimension()
this.reset(this.$element[dimension]())
this.transition('removeClass', 'hide', 'hidden')
this.$element[dimension](0)
}
, reset: function ( size ) {
var dimension = this.dimension()
this.$element
.removeClass('collapse')
[dimension](size || 'auto')
[0].offsetWidth
this.$element[size ? 'addClass' : 'removeClass']('collapse')
return this
}
, transition: function ( method, startEvent, completeEvent ) {
var that = this
, complete = function () {
if (startEvent == 'show') that.reset()
that.$element.trigger(completeEvent)
}
this.$element
.trigger(startEvent)
[method]('in')
$.support.transition && this.$element.hasClass('collapse') ?
this.$element.one($.support.transition.end, complete) :
complete()
}
, toggle: function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
}
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
$.fn.collapse = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('collapse')
, options = typeof option == 'object' && option
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.collapse.defaults = {
toggle: true
}
$.fn.collapse.Constructor = Collapse
/* COLLAPSIBLE DATA-API
* ==================== */
$(function () {
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
var $this = $(this), href
, target = $this.attr('data-target')
|| e.preventDefault()
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
, option = $(target).data('collapse') ? 'toggle' : $this.data()
$(target).collapse(option)
})
})
}( window.jQuery );
+92
View File
@@ -0,0 +1,92 @@
/* ============================================================
* bootstrap-dropdown.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
* ============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function( $ ){
"use strict"
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle="dropdown"]'
, Dropdown = function ( element ) {
var $el = $(element).on('click.dropdown.data-api', this.toggle)
$('html').on('click.dropdown.data-api', function () {
$el.parent().removeClass('open')
})
}
Dropdown.prototype = {
constructor: Dropdown
, toggle: function ( e ) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent
, isActive
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
$parent = $(selector)
$parent.length || ($parent = $this.parent())
isActive = $parent.hasClass('open')
clearMenus()
!isActive && $parent.toggleClass('open')
return false
}
}
function clearMenus() {
$(toggle).parent().removeClass('open')
}
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
$.fn.dropdown = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.dropdown.Constructor = Dropdown
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(function () {
$('html').on('click.dropdown.data-api', clearMenus)
$('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
})
}( window.jQuery );
+113
View File
@@ -0,0 +1,113 @@
/*
Bootstrap - File Input
======================
This is meant to convert all file input tags into a set of elements that displays consistently in all browsers.
Converts all
<input type="file">
into Bootstrap buttons
<a class="btn">Browse</a>
*/
$(function() {
$('input[type=file]').each(function(i,elem){
// Maybe some fields don't need to be standardized.
if (typeof $(this).attr('data-bfi-disabled') != 'undefined') {
return;
}
// Set the word to be displayed on the button
var buttonWord = gettext('Browse');
if (typeof $(this).attr('title') != 'undefined') {
buttonWord = $(this).attr('title');
}
// Start by getting the HTML of the input element.
// Thanks for the tip http://stackoverflow.com/a/1299069
var $elem = $(elem);
var input = $('<div>').append( $elem.eq(0).clone() ).html();
// Now we're going to replace that input field with a Bootstrap button.
// The input will actually still be there, it will just be float above and transparent (done with the CSS).
$elem.replaceWith('<a class="file-input-wrapper btn ' + $elem.attr('class') + '">'+buttonWord+input+'</a>');
})
// After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
// This is important because the in order to give the illusion that this is a button in FF we actually need to move the button from the file input under the cursor. Ugh.
.promise().done( function(){
// As the cursor moves over our new Bootstrap button we need to adjust the position of the invisible file input Browse button to be under the cursor.
// This gives us the pointer cursor that FF denies us
$('.file-input-wrapper').mousemove(function(cursor) {
var input, wrapper,
wrapperX, wrapperY,
inputWidth, inputHeight,
cursorX, cursorY;
// This wrapper element (the button surround this file input)
wrapper = $(this);
// The invisible file input element
input = wrapper.find("input");
// The left-most position of the wrapper
wrapperX = wrapper.offset().left;
// The top-most position of the wrapper
wrapperY = wrapper.offset().top;
// The with of the browsers input field
inputWidth= input.width();
// The height of the browsers input field
inputHeight= input.height();
//The position of the cursor in the wrapper
cursorX = cursor.pageX;
cursorY = cursor.pageY;
//The positions we are to move the invisible file input
// The 20 at the end is an arbitrary number of pixels that we can shift the input such that cursor is not pointing at the end of the Browse button but somewhere nearer the middle
moveInputX = cursorX - wrapperX - inputWidth + 20;
// Slides the invisible input Browse button to be positioned middle under the cursor
moveInputY = cursorY- wrapperY - (inputHeight/2);
// Apply the positioning styles to actually move the invisible file input
input.css({
left:moveInputX,
top:moveInputY
});
});
$('.file-input-wrapper input[type=file]').change(function(){
// Remove any previous file names
$(this).parent().next('.file-input-name').remove();
if ($(this).prop('files').length > 1) {
count = $(this).prop('files').length;
str = '<div class="file-input-name">'
for (var i=0; i<count ; i++)
{
str += this.files[i].name+'<br>';
}
str += '</div>';
$(this).parent().after(str);
}
else {
$(this).parent().after('<div class="file-input-name">'+$(this).val().replace('C:\\fakepath\\','')+'</div>');
}
});
});
// Add the styles before the first stylesheet
// This ensures they can be easily overridden with developer styles
var cssHtml = '<style>'+
'.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
'.file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover { position: absolute; top: 0; left: 0; cursor: pointer; opacity: 0; filter: alpha(opacity=0); z-index: 99; outline: 0; }'+
'.file-input-name { padding:5px 5px 0px 20px; }'+
'</style>';
$('link[rel=stylesheet]').eq(0).before(cssHtml);
});
+211
View File
@@ -0,0 +1,211 @@
/* =========================================================
* bootstrap-modal.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( $ ){
"use strict"
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function ( content, options ) {
this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
}
Modal.prototype = {
constructor: Modal
, toggle: function () {
return this[!this.isShown ? 'show' : 'hide']()
}
, show: function () {
var that = this
if (this.isShown) return
$('body').addClass('modal-open')
this.isShown = true
this.$element.trigger('show')
escape.call(this)
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
!that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
that.$element
.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element.addClass('in')
transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
})
}
, hide: function ( e ) {
e && e.preventDefault()
if (!this.isShown) return
var that = this
this.isShown = false
$('body').removeClass('modal-open')
escape.call(this)
this.$element
.trigger('hide')
.removeClass('in')
$.support.transition && this.$element.hasClass('fade') ?
hideWithTransition.call(this) :
hideModal.call(this)
}
}
/* MODAL PRIVATE METHODS
* ===================== */
function hideWithTransition() {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end)
hideModal.call(that)
}, 500)
this.$element.one($.support.transition.end, function () {
clearTimeout(timeout)
hideModal.call(that)
})
}
function hideModal( that ) {
this.$element
.hide()
.trigger('hidden')
backdrop.call(this)
}
function backdrop( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
/* Modify for Qnap KVM
if (this.options.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}*/
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
doAnimate ?
this.$backdrop.one($.support.transition.end, callback) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
removeBackdrop.call(this)
} else if (callback) {
callback()
}
}
function removeBackdrop() {
this.$backdrop.remove()
this.$backdrop = null
}
function escape() {
var that = this
if (this.isShown && this.options.keyboard) {
$(document).on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
$(document).off('keyup.dismiss.modal')
}
}
/* MODAL PLUGIN DEFINITION
* ======================= */
$.fn.modal = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else if (options.show) data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Constructor = Modal
/* MODAL DATA-API
* ============== */
$(function () {
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
e.preventDefault()
$target.modal(option)
})
})
}( window.jQuery );
+95
View File
@@ -0,0 +1,95 @@
/* ===========================================================
* bootstrap-popover.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#popovers
* ===========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =========================================================== */
!function( $ ) {
"use strict"
var Popover = function ( element, options ) {
this.init('popover', element, options)
}
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
========================================== */
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
constructor: Popover
, setContent: function () {
var $tip = this.tip()
, title = this.getTitle()
, content = this.getContent()
$tip.find('.popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
$tip.find('.popover-content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
$tip.removeClass('fade top bottom left right in')
}
, hasContent: function () {
return this.getTitle() || this.getContent()
}
, getContent: function () {
var content
, $e = this.$element
, o = this.options
content = $e.attr('data-content')
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
content = content.toString().replace(/(^\s*|\s*$)/, "")
return content
}
, tip: function() {
if (!this.$tip) {
this.$tip = $(this.options.template)
}
return this.$tip
}
})
/* POPOVER PLUGIN DEFINITION
* ======================= */
$.fn.popover = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('popover')
, options = typeof option == 'object' && option
if (!data) $this.data('popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.popover.Constructor = Popover
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
placement: 'right'
, content: ''
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
})
}( window.jQuery );
+125
View File
@@ -0,0 +1,125 @@
/* =============================================================
* bootstrap-scrollspy.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================== */
!function ( $ ) {
"use strict"
/* SCROLLSPY CLASS DEFINITION
* ========================== */
function ScrollSpy( element, options) {
var process = $.proxy(this.process, this)
, $element = $(element).is('body') ? $(window) : $(element)
, href
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
this.$scrollElement = $element.on('scroll.scroll.data-api', process)
this.selector = (this.options.target
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|| '') + ' .nav li > a'
this.$body = $('body').on('click.scroll.data-api', this.selector, process)
this.refresh()
this.process()
}
ScrollSpy.prototype = {
constructor: ScrollSpy
, refresh: function () {
this.targets = this.$body
.find(this.selector)
.map(function () {
var href = $(this).attr('href')
return /^#\w/.test(href) && $(href).length ? href : null
})
this.offsets = $.map(this.targets, function (id) {
return $(id).position().top
})
}
, process: function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
, offsets = this.offsets
, targets = this.targets
, activeTarget = this.activeTarget
, i
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate( targets[i] )
}
}
, activate: function (target) {
var active
this.activeTarget = target
this.$body
.find(this.selector).parent('.active')
.removeClass('active')
active = this.$body
.find(this.selector + '[href="' + target + '"]')
.parent('li')
.addClass('active')
if ( active.parent('.dropdown-menu') ) {
active.closest('li.dropdown').addClass('active')
}
}
}
/* SCROLLSPY PLUGIN DEFINITION
* =========================== */
$.fn.scrollspy = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('scrollspy')
, options = typeof option == 'object' && option
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.scrollspy.Constructor = ScrollSpy
$.fn.scrollspy.defaults = {
offset: 10
}
/* SCROLLSPY DATA-API
* ================== */
$(function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
$spy.scrollspy($spy.data())
})
})
}( window.jQuery );
+130
View File
@@ -0,0 +1,130 @@
/* ========================================================
* bootstrap-tab.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#tabs
* ========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================== */
!function( $ ){
"use strict"
/* TAB CLASS DEFINITION
* ==================== */
var Tab = function ( element ) {
this.element = $(element)
}
Tab.prototype = {
constructor: Tab
, show: function () {
var $this = this.element
, $ul = $this.closest('ul:not(.dropdown-menu)')
, selector = $this.attr('data-target')
, previous
, $target
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
if ( $this.parent('li').hasClass('active') ) return
previous = $ul.find('.active a').last()[0]
$this.trigger({
type: 'show'
, relatedTarget: previous
})
$target = $(selector)
this.activate($this.parent('li'), $ul)
this.activate($target, $target.parent(), function () {
$this.trigger({
type: 'shown'
, relatedTarget: previous
})
})
}
, activate: function ( element, container, callback) {
var $active = container.find('> .active')
, transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active.one($.support.transition.end, next) :
next()
$active.removeClass('in')
}
}
/* TAB PLUGIN DEFINITION
* ===================== */
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tab')
if (!data) $this.data('tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tab.Constructor = Tab
/* TAB DATA-API
* ============ */
$(function () {
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
})
}( window.jQuery );
+270
View File
@@ -0,0 +1,270 @@
/* ===========================================================
* bootstrap-tooltip.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame
* ===========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function( $ ) {
"use strict"
/* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */
var Tooltip = function ( element, options ) {
this.init('tooltip', element, options)
}
Tooltip.prototype = {
constructor: Tooltip
, init: function ( type, element, options ) {
var eventIn
, eventOut
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.enabled = true
if (this.options.trigger != 'manual') {
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
, getOptions: function ( options ) {
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay
, hide: options.delay
}
}
return options
}
, enter: function ( e ) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.show) {
self.show()
} else {
self.hoverState = 'in'
setTimeout(function() {
if (self.hoverState == 'in') {
self.show()
}
}, self.options.delay.show)
}
}
, leave: function ( e ) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
if (!self.options.delay || !self.options.delay.hide) {
self.hide()
} else {
self.hoverState = 'out'
setTimeout(function() {
if (self.hoverState == 'out') {
self.hide()
}
}, self.options.delay.hide)
}
}
, show: function () {
var $tip
, inside
, pos
, actualWidth
, actualHeight
, placement
, tp
if (this.hasContent() && this.enabled) {
$tip = this.tip()
this.setContent()
if (this.options.animation) {
$tip.addClass('fade')
}
placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
inside = /in/.test(placement)
$tip
.remove()
.css({ top: 0, left: 0, display: 'block' })
.appendTo(inside ? this.$element : document.body)
pos = this.getPosition(inside)
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
switch (inside ? placement.split(' ')[1] : placement) {
case 'bottom':
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'top':
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
break
case 'left':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
break
case 'right':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
break
}
$tip
.css(tp)
.addClass(placement)
.addClass('in')
}
}
, setContent: function () {
var $tip = this.tip()
$tip.find('.tooltip-inner').html(this.getTitle())
$tip.removeClass('fade in top bottom left right')
}
, hide: function () {
var that = this
, $tip = this.tip()
$tip.removeClass('in')
function removeWithAnimation() {
var timeout = setTimeout(function () {
$tip.off($.support.transition.end).remove()
}, 500)
$tip.one($.support.transition.end, function () {
clearTimeout(timeout)
$tip.remove()
})
}
$.support.transition && this.$tip.hasClass('fade') ?
removeWithAnimation() :
$tip.remove()
}
, fixTitle: function () {
var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
}
}
, hasContent: function () {
return this.getTitle()
}
, getPosition: function (inside) {
return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
width: this.$element[0].offsetWidth
, height: this.$element[0].offsetHeight
})
}
, getTitle: function () {
var title
, $e = this.$element
, o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
title = (title || '').toString().replace(/(^\s*|\s*$)/, "")
return title
}
, tip: function () {
return this.$tip = this.$tip || $(this.options.template)
}
, validate: function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
, enable: function () {
this.enabled = true
}
, disable: function () {
this.enabled = false
}
, toggleEnabled: function () {
this.enabled = !this.enabled
}
, toggle: function () {
this[this.tip().hasClass('in') ? 'hide' : 'show']()
}
}
/* TOOLTIP PLUGIN DEFINITION
* ========================= */
$.fn.tooltip = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tooltip')
, options = typeof option == 'object' && option
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tooltip.Constructor = Tooltip
$.fn.tooltip.defaults = {
animation: true
, delay: 0
, selector: false
, placement: 'top'
, trigger: 'hover'
, title: ''
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
}
}( window.jQuery );
+60
View File
@@ -0,0 +1,60 @@
/* ===================================================
* bootstrap-transition.js v2.3.2
* http://twitter.github.com/bootstrap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
$(function () {
$.support.transition = (function () {
var transitionEnd = (function () {
var el = document.createElement('bootstrap')
, transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd'
, 'MozTransition' : 'transitionend'
, 'OTransition' : 'oTransitionEnd otransitionend'
, 'transition' : 'transitionend'
}
, name
for (name in transEndEventNames){
if (el.style[name] !== undefined) {
return transEndEventNames[name]
}
}
}())
return transitionEnd && {
end: transitionEnd
}
})()
})
}(window.jQuery);
+271
View File
@@ -0,0 +1,271 @@
/* =============================================================
* bootstrap-typeahead.js v2.0.2
* http://twitter.github.com/bootstrap/javascript.html#typeahead
* =============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function( $ ){
"use strict"
var Typeahead = function ( element, options ) {
this.$element = $(element)
this.options = $.extend({}, $.fn.typeahead.defaults, options)
this.matcher = this.options.matcher || this.matcher
this.sorter = this.options.sorter || this.sorter
this.highlighter = this.options.highlighter || this.highlighter
this.$menu = $(this.options.menu).appendTo('body')
this.source = this.options.source
this.shown = false
this.listen()
}
Typeahead.prototype = {
constructor: Typeahead
, select: function () {
var val = this.$menu.find('.active').attr('data-value')
this.$element.val(val)
this.$element.change();
return this.hide()
}
, show: function () {
var pos = $.extend({}, this.$element.offset(), {
height: this.$element[0].offsetHeight
})
this.$menu.css({
top: pos.top + pos.height
, left: pos.left
})
this.$menu.show()
this.shown = true
return this
}
, hide: function () {
this.$menu.hide()
this.shown = false
return this
}
, lookup: function (event) {
var that = this
, items
, q
this.query = this.$element.val()
if (!this.query) {
return this.shown ? this.hide() : this
}
items = $.grep(this.source, function (item) {
if (that.matcher(item)) return item
})
items = this.sorter(items)
if (!items.length) {
return this.shown ? this.hide() : this
}
return this.render(items.slice(0, this.options.items)).show()
}
, matcher: function (item) {
return ~item.toLowerCase().indexOf(this.query.toLowerCase())
}
, sorter: function (items) {
var beginswith = []
, caseSensitive = []
, caseInsensitive = []
, item
while (item = items.shift()) {
if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
else if (~item.indexOf(this.query)) caseSensitive.push(item)
else caseInsensitive.push(item)
}
return beginswith.concat(caseSensitive, caseInsensitive)
}
, highlighter: function (item) {
return item.replace(new RegExp('(' + this.query + ')', 'ig'), function ($1, match) {
return '<strong>' + match + '</strong>'
})
}
, render: function (items) {
var that = this
items = $(items).map(function (i, item) {
i = $(that.options.item).attr('data-value', item)
i.find('a').html(that.highlighter(item))
return i[0]
})
items.first().addClass('active')
this.$menu.html(items)
return this
}
, next: function (event) {
var active = this.$menu.find('.active').removeClass('active')
, next = active.next()
if (!next.length) {
next = $(this.$menu.find('li')[0])
}
next.addClass('active')
}
, prev: function (event) {
var active = this.$menu.find('.active').removeClass('active')
, prev = active.prev()
if (!prev.length) {
prev = this.$menu.find('li').last()
}
prev.addClass('active')
}
, listen: function () {
this.$element
.on('blur', $.proxy(this.blur, this))
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
if ($.browser.webkit || $.browser.msie) {
this.$element.on('keydown', $.proxy(this.keypress, this))
}
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}
, keyup: function (e) {
switch(e.keyCode) {
case 40: // down arrow
case 38: // up arrow
break
case 9: // tab
case 13: // enter
if (!this.shown) return
this.select()
break
case 27: // escape
if (!this.shown) return
this.hide()
break
default:
this.lookup()
}
e.stopPropagation()
e.preventDefault()
}
, keypress: function (e) {
if (!this.shown) return
switch(e.keyCode) {
case 9: // tab
case 13: // enter
case 27: // escape
e.preventDefault()
break
case 38: // up arrow
e.preventDefault()
this.prev()
break
case 40: // down arrow
e.preventDefault()
this.next()
break
}
e.stopPropagation()
}
, blur: function (e) {
var that = this
setTimeout(function () { that.hide() }, 150)
}
, click: function (e) {
e.stopPropagation()
e.preventDefault()
this.select()
}
, mouseenter: function (e) {
this.$menu.find('.active').removeClass('active')
$(e.currentTarget).addClass('active')
}
}
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
$.fn.typeahead = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('typeahead')
, options = typeof option == 'object' && option
if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.typeahead.defaults = {
source: []
, items: 8
, menu: '<ul class="typeahead dropdown-menu"></ul>'
, item: '<li><a href="#"></a></li>'
}
$.fn.typeahead.Constructor = Typeahead
/* TYPEAHEAD DATA-API
* ================== */
$(function () {
$('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
var $this = $(this)
if ($this.data('typeahead')) return
e.preventDefault()
$this.typeahead($this.data())
})
})
}( window.jQuery );
Vendored Executable
+1726
View File
File diff suppressed because it is too large Load Diff
+6
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
+186
View File
@@ -0,0 +1,186 @@
/* encode function start */
var ezEncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var ezDecodeChars = new Array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 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, -1, -1, -1, -1, -1,
-1, 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, -1, -1, -1, -1, -1);
function utf16to8(str)
{
var out, i, len, c;
out = "";
len = str.length;
for (i=0; i<len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
}
else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >>6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >>0) & 0x3F));
}
else {
out += String.fromCharCode(0xC0 | ((c >>6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >>0) & 0x3F));
}
}
return out;
}
function utf8to16(str) {
var out, i, len, c;
var char2, char3;
out = "";
len = str.length;
i = 0;
while(i < len) {
c = str.charCodeAt(i++);
switch(c >> 4)
{
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
// 0xxxxxxx
out += str.charAt(i-1);
break;
case 12: case 13:
// 110x xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
// 1110 xxxx10xx xxxx10xx xxxx
char2 = str.charCodeAt(i++);
char3 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x0F) << 12) |
((char2 & 0x3F) << 6) |
((char3 & 0x3F) << 0));
}
}
return out;
}
function ezEncode(str)
{
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while(i < len)
{
c1 = str.charCodeAt(i++) & 0xff;
if(i == len)
{
out += ezEncodeChars.charAt(c1 >> 2);
out += ezEncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if(i == len)
{
out += ezEncodeChars.charAt(c1 >> 2);
out += ezEncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += ezEncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += ezEncodeChars.charAt(c1 >> 2);
out += ezEncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += ezEncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
out += ezEncodeChars.charAt(c3 & 0x3F);
}
return out;
}
function ezDecode(str) {
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0;
out = "";
while (i < len) {
/* c1 */
do {
c1 = this.ezDecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c1 == -1);
if (c1 == -1) {
break;
}
/* c2 */
do {
c2 = this.ezDecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c2 == -1);
if (c2 == -1) {
break;
}
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) & 0xff;
if (c3 == 61) {
return out;
}
c3 = this.ezDecodeChars[c3];
} while (i < len && c3 == -1);
if (c3 == -1) {
break;
}
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) & 0xff;
if (c4 == 61) {
return out;
}
c4 = this.ezDecodeChars[c4];
} while (i < len && c4 == -1);
if (c4 == -1) {
break;
}
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
}
/*
Ext.Ajax.request({
url: '/cgi-bin/authLogin.cgi',
success: function(o){
var authResponse = o.responseText.split("\n");
var sidString = authResponse[3];
DS.nasInfo.sid = authResponse[3].substr(18,8);
DS.nasInfo.user = 'admin';
//alert(WFM.nasInfo.sid)
},
failure: function(o){
},
params: {
user: 'admin',
pwd: ezEncode(utf16to8('admin'))
}
});*/
Vendored Executable
+15009
View File
File diff suppressed because it is too large Load Diff
+281
View File
@@ -0,0 +1,281 @@
// jQuery Alert Dialogs Plugin
//
// Version 1.0
// Download by http://www.bvbsoft.com
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
// 29 December 2008
//
// Visit http://abeautifulsite.net/notebook/87 for more information
//
// Usage:
// jAlert( message, [title, callback] )
// jConfirm( message, [title, callback] )
// jPrompt( message, [value, title, callback] )
//
// History:
//
// 1.00 - Released (29 December 2008)
//
// License:
//
// This plugin is licensed under the GNU General Public License: http://www.gnu.org/licenses/gpl.html
//
(function($) {
$.alerts = {
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
repositionOnResize: true, // re-centers the dialog on window resize
overlayOpacity: .01, // transparency level of overlay
overlayColor: '#FFF', // base color of overlay
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
okButton: gettext(' OK '), // text for the OK button
cancelButton: gettext(' Cancel '), // text for the Cancel button
yesButton: gettext(' Yes '), // text for the Yes button
noButton: gettext(' No '), // text for the No button
dialogClass: null, // if specified, this class will be applied to all dialogs
// Public methods
alert: function(message, title, callback, blackMask) {
if( title == null ) title = 'Alert';
$.alerts._show(title, message, null, 'alert', function(result) {
if( callback ) callback(result);
}, blackMask);
},
confirm: function(message, title, callback, blackMask, OKBtn, cancelBtn) {
if( title == null ) title = 'Confirm';
if(blackMask){
$.alerts.overlayOpacity=0.5;
$.alerts.overlayColor='#000';
}
$.alerts._show(title, message, null, 'confirm', function(result) {
if( callback ) callback(result);
},blackMask,OKBtn,cancelBtn);
},
confirm3: function(message, title, callback) {
if( title == null ) title = 'Confirm';
$.alerts._show(title, message, null, 'confirm3', function(result) {
if( callback ) callback(result);
});
},
prompt: function(message, value, title, callback) {
if( title == null ) title = 'Prompt';
$.alerts._show(title, message, value, 'prompt', function(result) {
if( callback ) callback(result);
});
},
// Private methods
_show: function(title, msg, value, type, callback, blackMask, OKBtn, cancelBtn) {
$.alerts._hide();
$.alerts._overlay('show');
var okButton = OKBtn ? OKBtn:gettext(' OK ');
var cancelButton = cancelBtn ? cancelBtn:gettext(' Cancel ');
$("BODY").append(
'<div id="popup_container">' +
'<h1 id="popup_title"></h1>' +
'<div id="popup_content">' +
'<div id="popup_message"></div>' +
'</div>' +
'</div>');
if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
// IE6 Fix
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
$("#popup_container").css({
position: pos,
zIndex: 99999,
padding: 0,
margin: 0
});
if(blackMask=='blackMaskJava')
$("#popup_container").css('border-radius','0px');
$("#popup_title").text(title);
$("#popup_content").addClass(type);
$("#popup_message").text(msg);
$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
$("#popup_container").css({
minWidth: $("#popup_container").outerWidth(),
maxWidth: $("#popup_container").outerWidth()
});
$.alerts._reposition();
$.alerts._maintainPosition(true);
switch( type ) {
case 'alert':
$("#popup_content").after('<div id="popup_panel"><input type="button" class="btn" value="' + okButton + '" id="popup_ok" /></div>');
$("#popup_ok").click( function() {
$.alerts._hide();
callback(true);
});
$("#popup_ok").focus().keypress( function(e) {
if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
});
break;
case 'confirm':
$("#popup_content").after('<div id="popup_panel"><input type="button" class="btn" value="' + okButton + '" id="popup_ok" /> <input type="button" class="btn" value="' + cancelButton + '" id="popup_cancel" /></div>');
$("#popup_ok").click( function() {
$.alerts._hide();
if( callback ) callback(true);
});
$("#popup_cancel").click( function() {
$.alerts._hide();
if( callback ) callback(false);
});
$("#popup_ok").focus();
$("#popup_ok, #popup_cancel").keypress( function(e) {
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
});
break;
case 'confirm3':
$("#popup_content").after('<div id="popup_panel"><input type="button" class="btn" value="' + $.alerts.yesButton + '" id="popup_yes" /> <input type="button" class="btn" value="' + $.alerts.noButton + '" id="popup_no" /> <input type="button" class="btn" value="' + cancelButton + '" id="popup_cancel" /></div>');
$("#popup_yes").click( function() {
$.alerts._hide();
if( callback ) callback('yes');
});
$("#popup_no").click( function() {
$.alerts._hide();
if( callback ) callback('no');
});
$("#popup_cancel").click( function() {
$.alerts._hide();
if( callback ) callback('cancel');
});
$("#popup_yes").focus();
$("#popup_yes, #popup_no, #popup_cancel").keypress( function(e) {
if(( e.keyCode == 13 ) || ( String.fromCharCode(e.charCode) == 'y' )) $("#popup_yes").trigger('click'); // enter, y
if( String.fromCharCode(e.charCode) == 'n' ) $("#popup_no").trigger('click'); // n
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click'); // escape
});
break;
case 'prompt':
$("#popup_content").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" class="btn" value="' + okButton + '" id="popup_ok" /> <input type="button" class="btn" value="' + cancelButton + '" id="popup_cancel" /></div>');
$("#popup_prompt").width( $("#popup_message").width() );
$("#popup_ok").click( function() {
var val = $("#popup_prompt").val();
$.alerts._hide();
if( callback ) callback( val );
});
$("#popup_cancel").click( function() {
$.alerts._hide();
if( callback ) callback( null );
});
$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
});
if( value ) $("#popup_prompt").val(value);
$("#popup_prompt").focus().select();
break;
}
// Make draggable
if( $.alerts.draggable ) {
try {
$("#popup_container").draggable({ handle: $("#popup_title") });
$("#popup_title").css({ cursor: 'move' });
} catch(e) { /* requires jQuery UI draggables */ }
}
},
_hide: function() {
$("#popup_container").remove();
$.alerts._overlay('hide');
$.alerts._maintainPosition(false);
},
_overlay: function(status) {
switch( status ) {
case 'show':
$.alerts._overlay('hide');
$("BODY").append('<div id="popup_overlay"></div>');
$("#popup_overlay").css({
position: 'absolute',
zIndex: 99998,
top: '0px',
left: '0px',
width: '100%',
height: $(document).height(),
background: $.alerts.overlayColor,
opacity: $.alerts.overlayOpacity
});
$("#popup_overlay").append('<IFRAME style="Z-INDEX: -1; POSITION: absolute; WIDTH: 100%; HEIGHT: 100%; TOP: 0px; LEFT: 0px" frameBorder=0></IFRAME>');
break;
case 'hide':
$("#popup_overlay").remove();
break;
}
},
_reposition: function() {
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
if( top < 0 ) top = 0;
if( left < 0 ) left = 0;
// IE6 fix
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
$("#popup_container").css({
top: top + 'px',
left: left + 'px'
});
$("#popup_overlay").height( $(document).height() );
},
_maintainPosition: function(status) {
if( $.alerts.repositionOnResize ) {
switch(status) {
case true:
$(window).bind('resize', function() {
$.alerts._reposition();
});
break;
case false:
$(window).unbind('resize');
break;
}
}
}
}
// Shortuct functions
jAlert = function(message, title, callback, blackMask) {
$.alerts.alert(message, title, callback, blackMask);
}
jConfirm = function(message, title, callback, blackMask, OKBtn, cancelBtn) {
$.alerts.confirm(message, title, callback, blackMask, OKBtn, cancelBtn);
};
jConfirm3 = function(message, title, callback) {
$.alerts.confirm3(message, title, callback);
};
jPrompt = function(message, value, title, callback) {
$.alerts.prompt(message, value, title, callback);
};
})(jQuery);
+6
View File
File diff suppressed because one or more lines are too long
+10
View File
@@ -0,0 +1,10 @@
/*
jquery.fullscreen 1.1.4
https://github.com/kayahr/jquery-fullscreen-plugin
Copyright (C) 2012 Klaus Reimer <k@ailis.de>
Licensed under the MIT license
(See http://www.opensource.org/licenses/mit-license)
*/
function d(b){var c,a;if(!this.length)return this;c=this[0];c.ownerDocument?a=c.ownerDocument:(a=c,c=a.documentElement);if(null==b){if(!a.cancelFullScreen&&!a.webkitCancelFullScreen&&!a.mozCancelFullScreen)return null;b=!!a.fullScreen||!!a.webkitIsFullScreen||!!a.mozFullScreen;return!b?b:a.fullScreenElement||a.webkitCurrentFullScreenElement||a.mozFullScreenElement||b}b?(b=c.requestFullScreen||c.webkitRequestFullScreen||c.mozRequestFullScreen)&&b.call(c,Element.ALLOW_KEYBOARD_INPUT):(b=a.cancelFullScreen||
a.webkitCancelFullScreen||a.mozCancelFullScreen)&&b.call(a);return this}jQuery.fn.fullScreen=d;jQuery.fn.toggleFullScreen=function(){return d.call(this,!d.call(this))};var e,f,g;e=document;e.webkitCancelFullScreen?(f="webkitfullscreenchange",g="webkitfullscreenerror"):e.mozCancelFullScreen?(f="mozfullscreenchange",g="mozfullscreenerror"):(f="fullscreenchange",g="fullscreenerror");jQuery(document).bind(f,function(){jQuery(document).trigger(new jQuery.Event("fullscreenchange"))});
jQuery(document).bind(g,function(){jQuery(document).trigger(new jQuery.Event("fullscreenerror"))});
Vendored Executable
+9252
View File
File diff suppressed because it is too large Load Diff
+251
View File
@@ -0,0 +1,251 @@
/*
* Treeview 1.4 - jQuery plugin to hide and show branches of a tree
*
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
* http://docs.jquery.com/Plugins/Treeview
*
* Copyright (c) 2007 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $
*
*/
;(function($) {
$.extend($.fn, {
swapClass: function(c1, c2) {
var c1Elements = this.filter('.' + c1);
this.filter('.' + c2).removeClass(c2).addClass(c1);
c1Elements.removeClass(c1).addClass(c2);
return this;
},
replaceClass: function(c1, c2) {
return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
},
hoverClass: function(className) {
className = className || "hover";
return this.hover(function() {
$(this).addClass(className);
}, function() {
$(this).removeClass(className);
});
},
heightToggle: function(animated, callback) {
animated ?
this.animate({ height: "toggle" }, animated, callback) :
this.each(function(){
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
if(callback)
callback.apply(this, arguments);
});
},
heightHide: function(animated, callback) {
if (animated) {
this.animate({ height: "hide" }, animated, callback);
} else {
this.hide();
if (callback)
this.each(callback);
}
},
prepareBranches: function(settings) {
if (!settings.prerendered) {
// mark last tree items
this.filter(":last-child:not(ul)").addClass(CLASSES.last);
// collapse whole tree, or only those marked as closed, anyway except those marked as open
this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
}
// return all items with sublists
return this.filter(":has(>ul)");
},
applyClasses: function(settings, toggler) {
this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
toggler.apply($(this).next());
}).add( $("a", this) ).hoverClass();
if (!settings.prerendered) {
// handle closed ones first
this.filter(":has(>ul:hidden)")
.addClass(CLASSES.expandable)
.replaceClass(CLASSES.last, CLASSES.lastExpandable);
// handle open ones
this.not(":has(>ul:hidden)")
.addClass(CLASSES.collapsable)
.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
// create hitarea
this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() {
var classes = "";
$.each($(this).parent().attr("class").split(" "), function() {
classes += this + "-hitarea ";
});
$(this).addClass( classes );
});
}
// apply event to hitarea
this.find("div." + CLASSES.hitarea).click( toggler );
},
treeview: function(settings) {
settings = $.extend({
cookieId: "treeview"
}, settings);
if (settings.add) {
return this.trigger("add", [settings.add]);
}
if ( settings.toggle ) {
var callback = settings.toggle;
settings.toggle = function() {
return callback.apply($(this).parent()[0], arguments);
};
}
// factory for treecontroller
function treeController(tree, control) {
// factory for click handlers
function handler(filter) {
return function() {
// reuse toggle event handler, applying the elements to toggle
// start searching for all hitareas
toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
// for plain toggle, no filter is provided, otherwise we need to check the parent element
return filter ? $(this).parent("." + filter).length : true;
}) );
return false;
};
}
// click on first element to collapse tree
$("a:eq(0)", control).click( handler(CLASSES.collapsable) );
// click on second to expand tree
$("a:eq(1)", control).click( handler(CLASSES.expandable) );
// click on third to toggle tree
$("a:eq(2)", control).click( handler() );
}
// handle toggle event
function toggler() {
$(this)
.parent()
// swap classes for hitarea
.find(">.hitarea")
.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
// swap classes for parent li
.swapClass( CLASSES.collapsable, CLASSES.expandable )
.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
// find child lists
.find( ">ul" )
// toggle them
.heightToggle( settings.animated, settings.toggle );
if ( settings.unique ) {
$(this).parent()
.siblings()
// swap classes for hitarea
.find(">.hitarea")
.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
.end()
.replaceClass( CLASSES.collapsable, CLASSES.expandable )
.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
.find( ">ul" )
.heightHide( settings.animated, settings.toggle );
}
}
function serialize() {
function binary(arg) {
return arg ? 1 : 0;
}
var data = [];
branches.each(function(i, e) {
data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
});
$.cookie(settings.cookieId, data.join("") );
}
function deserialize() {
var stored = $.cookie(settings.cookieId);
if ( stored ) {
var data = stored.split("");
branches.each(function(i, e) {
$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
});
}
}
// add treeview class to activate styles
this.addClass("treeview");
// prepare branches and find all tree items with child lists
var branches = this.find("li").prepareBranches(settings);
switch(settings.persist) {
case "cookie":
var toggleCallback = settings.toggle;
settings.toggle = function() {
serialize();
if (toggleCallback) {
toggleCallback.apply(this, arguments);
}
};
deserialize();
break;
case "location":
var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); });
if ( current.length ) {
current.addClass("selected").parents("ul, li").add( current.next() ).show();
}
break;
}
branches.applyClasses(settings, toggler);
// if control option is set, create the treecontroller and show it
if ( settings.control ) {
treeController(this, settings.control);
//$(settings.control).show(); //disabled by Qnap
}
return this.bind("add", function(event, branches) {
$(branches).prev()
.removeClass(CLASSES.last)
.removeClass(CLASSES.lastCollapsable)
.removeClass(CLASSES.lastExpandable)
.find(">.hitarea")
.removeClass(CLASSES.lastCollapsableHitarea)
.removeClass(CLASSES.lastExpandableHitarea);
$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);
});
}
});
// classes used by the plugin
// need to be styled via external stylesheet, see first example
var CLASSES = $.fn.treeview.classes = {
open: "open",
closed: "closed",
expandable: "expandable",
expandableHitarea: "expandable-hitarea",
lastExpandableHitarea: "lastExpandable-hitarea",
collapsable: "collapsable",
collapsableHitarea: "collapsable-hitarea",
lastCollapsableHitarea: "lastCollapsable-hitarea",
lastCollapsable: "lastCollapsable",
lastExpandable: "lastExpandable",
last: "last",
hitarea: "hitarea"
};
// provide backwards compability
$.fn.Treeview = $.fn.treeview;
})(jQuery);
+497
View File
@@ -0,0 +1,497 @@
/*
* zClip :: jQuery ZeroClipboard v1.1.1
* http://steamdev.com/zclip
*
* Copyright 2011, SteamDev
* Released under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Date: Wed Jun 01, 2011
*/
(function ($) {
$.fn.zclip = function (params) {
if (typeof params == "object" && !params.length) {
var settings = $.extend({
path: 'ZeroClipboard.swf',
copy: null,
beforeCopy: null,
afterCopy: null,
clickAfter: true,
setHandCursor: true,
setCSSEffects: true
}, params);
return this.each(function () {
var o = $(this);
if (o.is(':visible') && (typeof settings.copy == 'string' || $.isFunction(settings.copy))) {
ZeroClipboard.setMoviePath(settings.path);
var clip = new ZeroClipboard.Client();
if($.isFunction(settings.copy)){
o.bind('zClip_copy',settings.copy);
}
if($.isFunction(settings.beforeCopy)){
o.bind('zClip_beforeCopy',settings.beforeCopy);
}
if($.isFunction(settings.afterCopy)){
o.bind('zClip_afterCopy',settings.afterCopy);
}
clip.setHandCursor(settings.setHandCursor);
clip.setCSSEffects(settings.setCSSEffects);
clip.addEventListener('mouseOver', function (client) {
o.trigger('mouseenter');
});
clip.addEventListener('mouseOut', function (client) {
o.trigger('mouseleave');
});
clip.addEventListener('mouseDown', function (client) {
o.trigger('mousedown');
if(!$.isFunction(settings.copy)){
clip.setText(settings.copy);
} else {
clip.setText(o.triggerHandler('zClip_copy'));
}
if ($.isFunction(settings.beforeCopy)) {
o.trigger('zClip_beforeCopy');
}
});
clip.addEventListener('complete', function (client, text) {
if ($.isFunction(settings.afterCopy)) {
o.trigger('zClip_afterCopy');
} else {
if (text.length > 500) {
text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)";
}
o.removeClass('hover');
alert("Copied text to clipboard:\n\n " + text);
}
if (settings.clickAfter) {
o.trigger('click');
}
});
clip.glue(o[0], o.parent()[0]);
$(window).bind('load resize',function(){clip.reposition();});
}
});
} else if (typeof params == "string") {
return this.each(function () {
var o = $(this);
params = params.toLowerCase();
var zclipId = o.data('zclipId');
var clipElm = $('#' + zclipId + '.zclip');
if (params == "remove") {
clipElm.remove();
o.removeClass('active hover');
} else if (params == "hide") {
clipElm.hide();
o.removeClass('active hover');
} else if (params == "show") {
clipElm.show();
}
});
}
}
})(jQuery);
// ZeroClipboard
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard = {
version: "1.0.7",
clients: {},
// registered upload clients on page, indexed by id
moviePath: 'ZeroClipboard.swf',
// URL to movie
nextId: 1,
// ID of next movie
$: function (thingy) {
// simple DOM lookup utility function
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
if (!thingy.addClass) {
// extend element with a few useful methods
thingy.hide = function () {
this.style.display = 'none';
};
thingy.show = function () {
this.style.display = '';
};
thingy.addClass = function (name) {
this.removeClass(name);
this.className += ' ' + name;
};
thingy.removeClass = function (name) {
var classes = this.className.split(/\s+/);
var idx = -1;
for (var k = 0; k < classes.length; k++) {
if (classes[k] == name) {
idx = k;
k = classes.length;
}
}
if (idx > -1) {
classes.splice(idx, 1);
this.className = classes.join(' ');
}
return this;
};
thingy.hasClass = function (name) {
return !!this.className.match(new RegExp("\\s*" + name + "\\s*"));
};
}
return thingy;
},
setMoviePath: function (path) {
// set path to ZeroClipboard.swf
this.moviePath = path;
},
dispatch: function (id, eventName, args) {
// receive event from flash movie, send to client
var client = this.clients[id];
if (client) {
client.receiveEvent(eventName, args);
}
},
register: function (id, client) {
// register new client to receive events
this.clients[id] = client;
},
getDOMObjectPosition: function (obj, stopObj) {
// get absolute coordinates for dom element
var info = {
left: 0,
top: 0,
width: obj.width ? obj.width : obj.offsetWidth,
height: obj.height ? obj.height : obj.offsetHeight
};
if (obj && (obj != stopObj)) {
info.left += obj.offsetLeft;
info.top += obj.offsetTop;
}
return info;
},
Client: function (elem) {
// constructor for new simple upload client
this.handlers = {};
// unique ID
this.id = ZeroClipboard.nextId++;
this.movieId = 'ZeroClipboardMovie_' + this.id;
// register client with singleton to receive flash events
ZeroClipboard.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
ZeroClipboard.Client.prototype = {
id: 0,
// unique ID for us
ready: false,
// whether movie is ready to receive events or not
movie: null,
// reference to movie object
clipText: '',
// text to copy to clipboard
handCursorEnabled: true,
// whether to show hand cursor, or default pointer cursor
cssEffects: true,
// enable CSS mouse effects on dom container
handlers: null,
// user event handlers
glue: function (elem, appendElem, stylesToAdd) {
// glue to DOM element
// elem can be ID or actual DOM element object
this.domElement = ZeroClipboard.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
if (this.domElement.style.zIndex) {
zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
}
if (typeof(appendElem) == 'string') {
appendElem = ZeroClipboard.$(appendElem);
} else if (typeof(appendElem) == 'undefined') {
appendElem = document.getElementsByTagName('body')[0];
}
// find X/Y position of domElement
var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
// create floating DIV above element
this.div = document.createElement('div');
this.div.className = "zclip";
this.div.id = "zclip-" + this.movieId;
$(this.domElement).data('zclipId', 'zclip-' + this.movieId);
var style = this.div.style;
//style.position = 'absolute';
//style.left = '' + box.left + 'px';
//style.top = '' + box.top + 'px';
style.margin = '-25px 0 0 0';
style.width = '' + box.width + 'px';
style.height = '' + box.height + 'px';
style.zIndex = zIndex;
if (typeof(stylesToAdd) == 'object') {
for (addedStyle in stylesToAdd) {
style[addedStyle] = stylesToAdd[addedStyle];
}
}
// style.backgroundColor = '#f00'; // debug
appendElem.appendChild(this.div);
this.div.innerHTML = this.getHTML(box.width, box.height);
},
getHTML: function (width, height) {
// return HTML for movie
var html = '';
var flashvars = 'id=' + this.id + '&width=' + width + '&height=' + height;
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + protocol + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '" id="' + this.movieId + '" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + ZeroClipboard.moviePath + '" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="' + flashvars + '"/><param name="wmode" value="transparent"/></object>';
} else {
// all other browsers get an EMBED tag
html += '<embed id="' + this.movieId + '" src="' + ZeroClipboard.moviePath + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="' + this.movieId + '" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + flashvars + '" wmode="transparent" />';
}
return html;
},
hide: function () {
// temporarily hide floater offscreen
if (this.div) {
this.div.style.left = '-2000px';
}
},
show: function () {
// show ourselves after a call to hide()
this.reposition();
},
destroy: function () {
// destroy control and floater
if (this.domElement && this.div) {
this.hide();
this.div.innerHTML = '';
var body = document.getElementsByTagName('body')[0];
try {
body.removeChild(this.div);
} catch (e) {;
}
this.domElement = null;
this.div = null;
}
},
reposition: function (elem) {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
this.domElement = ZeroClipboard.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
}
},
setText: function (newText) {
// set text to be copied to clipboard
this.clipText = newText;
if (this.ready) {
this.movie.setText(newText);
}
},
addEventListener: function (eventName, func) {
// add user event listener for event
// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
if (!this.handlers[eventName]) {
this.handlers[eventName] = [];
}
this.handlers[eventName].push(func);
},
setHandCursor: function (enabled) {
// enable hand cursor (true), or default arrow cursor (false)
this.handCursorEnabled = enabled;
if (this.ready) {
this.movie.setHandCursor(enabled);
}
},
setCSSEffects: function (enabled) {
// enable or disable CSS effects on DOM container
this.cssEffects = !! enabled;
},
receiveEvent: function (eventName, args) {
// receive event from flash
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
// special behavior for certain events
switch (eventName) {
case 'load':
// movie claims it is ready, but in IE this isn't always the case...
// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
this.movie = document.getElementById(this.movieId);
if (!this.movie) {
var self = this;
setTimeout(function () {
self.receiveEvent('load', null);
}, 1);
return;
}
// firefox on pc needs a "kick" in order to set these in certain cases
if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
var self = this;
setTimeout(function () {
self.receiveEvent('load', null);
}, 100);
this.ready = true;
return;
}
this.ready = true;
try {
this.movie.setText(this.clipText);
} catch (e) {}
try {
this.movie.setHandCursor(this.handCursorEnabled);
} catch (e) {}
break;
case 'mouseover':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('hover');
if (this.recoverActive) {
this.domElement.addClass('active');
}
}
break;
case 'mouseout':
if (this.domElement && this.cssEffects) {
this.recoverActive = false;
if (this.domElement.hasClass('active')) {
this.domElement.removeClass('active');
this.recoverActive = true;
}
this.domElement.removeClass('hover');
}
break;
case 'mousedown':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('active');
}
break;
case 'mouseup':
if (this.domElement && this.cssEffects) {
this.domElement.removeClass('active');
this.recoverActive = false;
}
break;
} // switch eventName
if (this.handlers[eventName]) {
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
var func = this.handlers[eventName][idx];
if (typeof(func) == 'function') {
// actual function reference
func(this, args);
} else if ((typeof(func) == 'object') && (func.length == 2)) {
// PHP style object + method, i.e. [myObject, 'myMethod']
func[0][func[1]](this, args);
} else if (typeof(func) == 'string') {
// name of function
window[func](this, args);
}
} // foreach event handler defined
} // user defined handler for event
}
};
+29
View File
@@ -0,0 +1,29 @@
function getMultiLanguage(){
var multiLanguage = [
{"id":"en","name":"English"},
{"id":"zh-cn","name":"简体中文"},
{"id":"zh-tw","name":"繁體中文"},
{"id":"cs","name":"Czech"},
{"id":"da","name":"Dansk"},
{"id":"de","name":"Deutsch"},
{"id":"es","name":"Español"},
{"id":"fr","name":"Français"},
{"id":"it","name":"Italiano"},
{"id":"ja","name":"日本語"},
{"id":"ko","name":"한글"},
{"id":"no","name":"Norsk"},
{"id":"pl","name":"Polski"},
{"id":"ru","name":"Русский"},
{"id":"fi","name":"Suomi"},
{"id":"sv","name":"Svenska"},
{"id":"nl","name":"Nederlands"},
{"id":"tr","name":"Türk"},
{"id":"th","name":"ไทย"},
{"id":"pt","name":"Português"},
{"id":"hu","name":"Magyar"},
{"id":"el","name":"Ελληνικά"},
{"id":"ro","name":"Român"}
];
return multiLanguage;
}
+16
View File
@@ -0,0 +1,16 @@
function scroll_fixed()
{
var lastScrollLeft=0;
$('#rightDiv').scroll(function(event) {
var documentScrollLeft = $(this).scrollLeft();
if (lastScrollLeft != documentScrollLeft) {
var newLeft=(-1*documentScrollLeft)-30;
$('.scroll_fixed').css({'margin-left':newLeft});
lastScrollLeft = documentScrollLeft;
}
});
}
+48
View File
@@ -0,0 +1,48 @@
function CheckImportSetting()
{
var msg = '';
// check import path
var ele = document.getElementById('ImportVMFrom').import_path;
ele.value = ele.value.replace(/(^\s*|\s*$)/g, "");
if (ele.value.length == 0) {
msg += gettext('Import Path must required.')+'\n'
}
// check vm name
ele = document.getElementById('ImportVMFrom').name;
ele.value = ele.value.replace(/(^\s*|\s*$)/g, "");
if (ele.value.length == 0) {
msg += gettext('VM name must required.')+'\n';
} else {
if (ele.value.length > 20) {
msg += gettext('VM name length can not be longer than 20 chars.')+'\n';
}
var re = /^([A-Za-z0-9_\-\.]+)$/g;
if (!re.test(ele.value)) {
msg += gettext('Invalid characters in VM name. Please only use:')+' a-z,A-Z,0-9,_,-,.\n';
}
}
//check mac
var cnt = 0;
var RegExPattern = /^([0-9a-fA-F]{1,2}[\.:-]){5}([0-9a-fA-F]{1,2})$/;
while (document.getElementById('mac_'+cnt)) {
ele = document.getElementById('mac_'+cnt);
if (!ele.value.match(RegExPattern)) {
msg += gettext('Invalid format of MAC')+' #' + (cnt+1) + '\n';
} else if (parseInt(ele.value.split(':')[0],16)%2){
msg += interpolate(gettext('First number of MAC #%(cnt)s must be even(ex.0,2,4,6,...)\n'),{'cnt':(cnt+1)},true);
}
cnt++;
}
if (msg.length > 0) {
alert(msg)
return false;
}
return true;
}
+143
View File
@@ -0,0 +1,143 @@
function _callbk_update_snapshot_progress_multiLanguage(){
return interpolate(gettext('Create snapshot [ %(snapshot_name_value)s ] successful'),{'snapshot_name_value':document.getElementById('snapshot_name_value').value},true);
}
function CheckAdvSumit()
{
var msg = '';
//check vnc port & password
var ele = document.getElementById("adv_vnc_port");
if (ele.options[ele.selectedIndex].value == "custom") {
var port = document.getElementById("adv_vnc_port_text").value;
var RegExPattern = /^[0-9]+$/;
if (!port.match(RegExPattern) ||
!(parseInt(port) >= 5900 && parseInt(port) <= 5930)) {
msg += gettext('Invalid Remote port.')+'\n';
} else {
for(var vm in InitInfo.vnc_used_ports){
if (parseInt(port) == InitInfo.vnc_used_ports[vm]) {
msg += interpolate(gettext('Remote port %(vnc_used_ports)s have been used by [ %(vm)s ].'),{'vnc_used_ports':InitInfo.vnc_used_ports[vm],'vm':vm},true)+'\n';
}
}
}
}
if (document.getElementById("adv_vnc_pwd_text").value) {
ele = document.getElementById("adv_vnc_pwd_text");
ele.value = ele.value.replace(/(^\s*|\s*$)/g, "");
var re = /^([A-Za-z0-9_\-\.]+)$/g;
if (!re.test(ele.value)) {
msg += gettext('Invalid characters in remote password name. Please only use:') +'a-z,A-Z,0-9,_,-,.\n';
}
if(ele.value != document.getElementById("adv_vnc_pwd_text_confirm").value){
msg += gettext('Password and confirmation password do not match')+'\n';
}
}
//check auto start with free memory
if (document.getElementById("adv_autostart").checked) {
if (InitInfo.autostart_cnt >= InitInfo.startvm_limit) {
msg += gettext('Exceed maximun auto start num')+':'+InitInfo.startvm_limit+'\n';
}
if (parseInt(document.getElementById("adv_memory").value) > InitInfo.auto_free_mem) {
msg += gettext('For auto start settings, memory must be smaller than ')+InitInfo.auto_free_mem+'MB\n';
}
ele = document.getElementById("adv_start_delay");
ele.value = ele.value.replace(/(^\s*|\s*$)/g, "");
var RegExPattern = /^[0-9]+$/;
if (!ele.value.match(RegExPattern) ||
!(parseInt(ele.value) >= 0 && parseInt(ele.value) <= 600)) {
msg += gettext('Invalid startup delay time.')+'\n';
}
}
//check mac
var cnt = 0;
var RegExPattern = /^([0-9a-fA-F]{1,2}[\.:-]){5}([0-9a-fA-F]{1,2})$/;
while (document.getElementById('adv_nw_mac'+cnt)) {
currentmac = document.getElementById('adv_nw_mac'+cnt).value;
if (!currentmac.match(RegExPattern)) {
msg += gettext('Invalid format of MAC')+' # '+ (cnt+1) + '\n';
} else if (parseInt(currentmac.split(':')[0],16)%2){
msg += interpolate(gettext('First number of MAC #%(cnt)s must be even(ex.0,2,4,6,...)'),{'cnt':(cnt+1)},true)+'\n';
}
for(var cc=cnt-1;cc>=0;cc--)
{
if (document.getElementById('adv_nw_mac'+cc).value == currentmac) {
msg += interpolate(gettext('MAC %(currentmac)s have been used by yourself.'),{'currentmac':currentmac},true)+'\n';
}
}
cnt++;
}
//check network interface
cnt = 0;
while (document.getElementsByName('adv_nw_mode'+cnt).length > 0) {
var mode = GetRadioBtnValue(document.getElementsByName('adv_nw_mode'+cnt));
if (((mode == 'direct') && !document.getElementById('adv_eths_combos'+cnt).value) ||
((mode == 'bridge') && !document.getElementById('adv_bridges_combos'+cnt).value)) {
msg += interpolate(gettext('Invalid interface mode for adapter %(cnt)s'),{'cnt':(cnt+1)},true)+'\n';
}
cnt++;
}
if (msg.length > 0) {
alert(msg)
return false;
}
return true;
}
function _callbk_before_advsubmit_check(http_request, elemBtn)
{
if (http_request.readyState == 4) {
CloseMask();
if (http_request.status == 200) {
var json = JSON.parse(http_request.responseText);
if (!json.success) {
alert(json.errors);
return;
}
var msg = '';
// check duplicate mac
var cnt = 0;
while (document.getElementById('adv_nw_mac'+cnt)) {
var currentmac = document.getElementById('adv_nw_mac'+cnt).value;
for (var i=0; i<json.used_macs.length; i++) {
if (currentmac == json.used_macs[i]) {
msg += interpolate(gettext('MAC #%(cnt)s [ %(used_macs)s ] have been used.'),{'cnt':(cnt+1),'used_macs':json.used_macs[i]},true)+'\n';
break;
}
}
cnt++;
}
if (msg.length > 0) {
alert(msg)
return false;
}
elemBtn.click();
} else {
alert(gettext('File check failed.'));
}
}
}
function ShowHideCloningWarning(cloningVM)
{
var elem = document.getElementById('cloning_warning');
var elem2 = document.getElementById('vm_background_msg_'+cloningVM);
elem.style.display = (cloningVM && !elem2) ? '' : 'none';
elem.innerHTML = interpolate(gettext('Please wait to VM[%(cloningVM)s] cloning finish.'),{'cloningVM':cloningVM},true);
}
function alertExisting(vmName){
alert(interpolate(gettext('The VM name [%(vmName)s] has been existing.'),{'vmName':vmName},true));
}
+29
View File
@@ -0,0 +1,29 @@
function _is_select_default_bridge(button)
{
var chked = $('#myModalnewstgForm input:radio[name="eth_pool"]').filter(':checked');
if (chked.length == 0) {
$('#error_msg').show();
return false;
}
if((noSpeed[chked.val()])&&(button!='smb')){
alert(interpolate(gettext('Please connect the network cable between %(noSpeed)s and Switch.'),{'noSpeed':noSpeed[chked.val()]},true), gotoNext);
return false;
}
/*{% for bri_name, bri_nic, show_name in bridge_inf_ary %}
var bri_idx = parseInt('{{ bri_name }}'.replace('br', '')) + 1;
if ((button!='smb') && (chked.val() == '{{ bri_nic }}')) {
jConfirm('Remove the interface from {{ show_name }}', 'Warnning', function(result) {
if (result) {
$('#error_msg').hide();
btn_wizard(1);
}
});
return false;
}
{% endfor %}*/
$('#error_msg').hide();
return true;
}