Updated JQuery; Added resize sensor library; Updated the admin code (prior to changing gears to use Meteor).
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<table id="dataTable" class="table table-striped table-hover">
|
||||
<table id="dataTable" class="table table-striped table-hover" tabindex="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-key-name="name">Name</th>
|
||||
@@ -99,7 +99,8 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
var dataTable = new LinkedTable($page.find('#dataTable'), {
|
||||
var $table = $page.find('#dataTable');
|
||||
$table.buildTable({
|
||||
url: "data/Venue/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
@@ -122,16 +123,19 @@ $(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
var dataTable = $table.getTable();
|
||||
|
||||
$page.find('#dataTable').on('dblclick', 'tr', function(event) {
|
||||
if(dataTable.getSelectedRow()) {
|
||||
location.hash = "#!/venues-edit";
|
||||
}
|
||||
});
|
||||
$page.find('#dataTable').on('keyup', 'table', function(event) {
|
||||
|
||||
$page.find('#page').on('keyup', '.page', function(event) {
|
||||
switch(event.keyCode || event.which) {
|
||||
case 0x0D: //Enter
|
||||
if(dataTable.getSelectedRow()) {
|
||||
$btnEdit.click();
|
||||
location.hash = '#!/venues-edit';
|
||||
}
|
||||
break;
|
||||
case 0x08: //Backspace
|
||||
@@ -144,9 +148,6 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
//Call the refresh user table function once initially.
|
||||
dataTable.build();
|
||||
|
||||
//Refresh the data table if the user toggles the button to show/hide deleted elements.
|
||||
$page.find('#includeDeletedToggle').on('click', function(event) {
|
||||
dataTable.refresh();
|
||||
@@ -247,6 +248,16 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
//Close the view if the user uses the escape key and it isn't handled at the widget level.
|
||||
$editorView.on('keyup', function(event) {
|
||||
switch(event.keyCode) {
|
||||
case 27:
|
||||
if(!event.isDefaultPrevented())
|
||||
history.back();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++ Delete View +++++++++++
|
||||
|
||||
|
||||
3
public/admin/bootstrap.styl
vendored
3
public/admin/bootstrap.styl
vendored
@@ -13,7 +13,8 @@ input[type="url"]:focus,
|
||||
input[type="search"]:focus,
|
||||
input[type="tel"]:focus,
|
||||
input[type="color"]:focus,
|
||||
.uneditable-input:focus {
|
||||
.uneditable-input:focus,
|
||||
.list-group:focus {
|
||||
border-color: rgba(82, 168, 236, 0.8);
|
||||
outline: 0;
|
||||
outline: thin dotted \9;
|
||||
|
||||
@@ -99,7 +99,8 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
var dataTable = new LinkedTable($page.find('#dataTable'), {
|
||||
var $table = $page.find('#dataTable');
|
||||
$table.buildTable({
|
||||
url: "data/Category/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
@@ -122,15 +123,14 @@ $(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
var dataTable = $table.getTable();
|
||||
|
||||
$page.find('#dataTable').on('dblclick', 'tr', function(event) {
|
||||
if(dataTable.getSelectedRow()) {
|
||||
location.hash = "#!/categories-edit";
|
||||
}
|
||||
});
|
||||
|
||||
//Call the refresh user table function once initially.
|
||||
dataTable.build();
|
||||
|
||||
//Refresh the data table if the user toggles the button to show/hide deleted elements.
|
||||
$page.find('#includeDeletedToggle').on('click', function(event) {
|
||||
dataTable.refresh();
|
||||
@@ -231,6 +231,16 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
//Close the view if the user uses the escape key and it isn't handled at the widget level.
|
||||
$editorView.on('keyup', function(event) {
|
||||
switch(event.keyCode) {
|
||||
case 27:
|
||||
if(!event.isDefaultPrevented())
|
||||
history.back();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++ Delete View +++++++++++
|
||||
|
||||
|
||||
258
public/admin/css/jsgrid-theme.css
Normal file
258
public/admin/css/jsgrid-theme.css
Normal file
File diff suppressed because one or more lines are too long
7
public/admin/css/jsgrid-theme.min.css
vendored
Normal file
7
public/admin/css/jsgrid-theme.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
126
public/admin/css/jsgrid.css
Normal file
126
public/admin/css/jsgrid.css
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* jsGrid v1.5.2 (http://js-grid.com)
|
||||
* (c) 2016 Artem Tabalin
|
||||
* Licensed under MIT (https://github.com/tabalinas/jsgrid/blob/master/LICENSE)
|
||||
*/
|
||||
|
||||
.jsgrid {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.jsgrid, .jsgrid *, .jsgrid *:before, .jsgrid *:after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.jsgrid input,
|
||||
.jsgrid textarea,
|
||||
.jsgrid select {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.jsgrid-grid-header {
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-o-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.jsgrid-grid-body {
|
||||
overflow-x: auto;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.jsgrid-table {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.jsgrid-cell {
|
||||
padding: 0.5em 0.5em;
|
||||
}
|
||||
|
||||
.jsgrid-сell,
|
||||
.jsgrid-header-cell {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.jsgrid-align-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.jsgrid-align-center,
|
||||
.jsgrid-align-center input,
|
||||
.jsgrid-align-center textarea,
|
||||
.jsgrid-align-center select {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jsgrid-align-right,
|
||||
.jsgrid-align-right input,
|
||||
.jsgrid-align-right textarea,
|
||||
.jsgrid-align-right select {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.jsgrid-header-cell {
|
||||
padding: .5em .5em;
|
||||
}
|
||||
|
||||
.jsgrid-filter-row input,
|
||||
.jsgrid-filter-row textarea,
|
||||
.jsgrid-filter-row select,
|
||||
.jsgrid-edit-row input,
|
||||
.jsgrid-edit-row textarea,
|
||||
.jsgrid-edit-row select,
|
||||
.jsgrid-insert-row input,
|
||||
.jsgrid-insert-row textarea,
|
||||
.jsgrid-insert-row select {
|
||||
width: 100%;
|
||||
padding: .3em .5em;
|
||||
}
|
||||
|
||||
.jsgrid-filter-row input[type='checkbox'],
|
||||
.jsgrid-edit-row input[type='checkbox'],
|
||||
.jsgrid-insert-row input[type='checkbox'] {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
|
||||
.jsgrid-selected-row .jsgrid-cell {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.jsgrid-nodata-row .jsgrid-cell {
|
||||
padding: .5em 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jsgrid-header-sort {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.jsgrid-pager {
|
||||
padding: .5em 0;
|
||||
}
|
||||
|
||||
.jsgrid-pager-nav-button {
|
||||
padding: .2em .6em;
|
||||
}
|
||||
|
||||
.jsgrid-pager-nav-inactive-button {
|
||||
display: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.jsgrid-pager-page {
|
||||
padding: .2em .6em;
|
||||
}
|
||||
7
public/admin/css/jsgrid.min.css
vendored
Normal file
7
public/admin/css/jsgrid.min.css
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* jsGrid v1.5.2 (http://js-grid.com)
|
||||
* (c) 2016 Artem Tabalin
|
||||
* Licensed under MIT (https://github.com/tabalinas/jsgrid/blob/master/LICENSE)
|
||||
*/
|
||||
|
||||
.jsgrid{position:relative;overflow:hidden;font-size:1em}.jsgrid,.jsgrid *,.jsgrid :after,.jsgrid :before{box-sizing:border-box}.jsgrid input,.jsgrid select,.jsgrid textarea{font-size:1em}.jsgrid-grid-header{overflow-x:hidden;overflow-y:scroll;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.jsgrid-grid-body{overflow-x:auto;overflow-y:scroll;-webkit-overflow-scrolling:touch}.jsgrid-table{width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0}.jsgrid-cell{padding:.5em}.jsgrid-header-cell,.jsgrid-сell{box-sizing:border-box}.jsgrid-align-left{text-align:left}.jsgrid-align-center,.jsgrid-align-center input,.jsgrid-align-center select,.jsgrid-align-center textarea{text-align:center}.jsgrid-align-right,.jsgrid-align-right input,.jsgrid-align-right select,.jsgrid-align-right textarea{text-align:right}.jsgrid-header-cell{padding:.5em}.jsgrid-edit-row input,.jsgrid-edit-row select,.jsgrid-edit-row textarea,.jsgrid-filter-row input,.jsgrid-filter-row select,.jsgrid-filter-row textarea,.jsgrid-insert-row input,.jsgrid-insert-row select,.jsgrid-insert-row textarea{width:100%;padding:.3em .5em}.jsgrid-edit-row input[type=checkbox],.jsgrid-filter-row input[type=checkbox],.jsgrid-insert-row input[type=checkbox]{width:auto}.jsgrid-selected-row .jsgrid-cell{cursor:pointer}.jsgrid-nodata-row .jsgrid-cell{padding:.5em 0;text-align:center}.jsgrid-header-sort{cursor:pointer}.jsgrid-pager{padding:.5em 0}.jsgrid-pager-nav-button{padding:.2em .6em}.jsgrid-pager-nav-inactive-button{display:none;pointer-events:none}.jsgrid-pager-page{padding:.2em .6em}
|
||||
@@ -26,10 +26,12 @@
|
||||
<link rel="stylesheet" href="css/select2.css"/>
|
||||
<link rel="stylesheet" href="css/bootstrap-datetimepicker.css"/>
|
||||
<link rel="stylesheet" href="css/jquery.editable.select.css"/>
|
||||
<link rel="stylesheet" href="main.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="css/jsgrid.css"/>
|
||||
<link rel="stylesheet" href="css/jsgrid-theme.css"/>
|
||||
<link rel="stylesheet" href="index.css" type="text/css"/>
|
||||
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-1.11.3.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-migrate-1.2.1.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-1.12.4.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-migrate-1.3.0.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.history.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.cycle.min.js"></script>
|
||||
@@ -38,15 +40,16 @@
|
||||
<script type="text/javascript" language="JavaScript" src="js/scroller.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/polyfills.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/main.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/LinkedTable.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/moment.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/select2.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/validator.js"></script> <!-- https://github.com/1000hz/bootstrap-validator http://1000hz.github.io/bootstrap-validator/ -->
|
||||
<script type="text/javascript" language="JavaScript" src="js/bootstrap-datetimepicker.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.tabbable.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.editable.select.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/EditableSelect.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/de.table.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/de.combo.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.disableSelection.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jsgrid.js"></script>
|
||||
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
//Add functionality to jquery to display a class listing.
|
||||
|
||||
@@ -203,4 +203,5 @@ sup, sub {
|
||||
@require "categories"
|
||||
@require "subcategories"
|
||||
@require "items"
|
||||
@require "sales"
|
||||
@require "sales"
|
||||
@require "prices"
|
||||
@@ -21,8 +21,7 @@
|
||||
<th data-key-name="name">Name</th>
|
||||
<th data-key-name="category">Category</th>
|
||||
<th data-key-name="subcategory">Subcategory</th>
|
||||
<th data-key-name="defaultPrice">Default Price</th>
|
||||
<th data-key-name="measures">Measures</th>
|
||||
<th data-key-name="prices">Prices</th>
|
||||
<th data-key-name="aliases">Aliases</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -38,29 +37,35 @@
|
||||
<h4 class="modal-title"></h4>
|
||||
</div>
|
||||
<form role="form" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<label for="DFName">Name</label>
|
||||
<div class="form-group">
|
||||
<input name="name" id="DFName" type="text" class="form-control" tabindex="0" placeholder="Strawberry Jam" required>
|
||||
<div class="modal-body row">
|
||||
<div class="col-sm-6">
|
||||
<label for="DFName">Name</label>
|
||||
<div class="form-group">
|
||||
<input name="name" id="DFName" type="text" class="form-control" tabindex="0" placeholder="Strawberry Jam" required>
|
||||
</div>
|
||||
<label for="DFSubcategory">Subcategory</label>
|
||||
<div class="form-group">
|
||||
<input name="subcategoryId" id="DFSubcategoryId" type="hidden"/>
|
||||
<input name="subcategory" id="DFSubcategory" class="form-control" type="text" tabindex="0" required/>
|
||||
</div>
|
||||
<label for="DFMeasures">Measures</label>
|
||||
<div class="form-group">
|
||||
<select class="js-states form-control" name="measures" id="DFMeasures" multiple="multiple" tabindex="0" style="width: 100%;" required></select>
|
||||
</div>
|
||||
</div>
|
||||
<label for="DFSubcategory">Subcategory</label>
|
||||
<div class="form-group">
|
||||
<input name="subcategoryId" id="DFSubcategoryId" type="hidden"/>
|
||||
<input name="subcategory" id="DFSubcategory" class="form-control" type="text" tabindex="0" required/>
|
||||
</div>
|
||||
<label for="DFPrice">Default Price</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">$</span><input name="defaultPrice" id="DFPrice" type="number" min="0.00" step="0.50" value="10.00" data-number-to-fixed="2" class="form-control currency" tabindex="0" required>
|
||||
</div>
|
||||
<label for="DFMeasures">Measures</label>
|
||||
<div class="form-group">
|
||||
<select class="js-states form-control" name="measures" id="DFMeasures" multiple="multiple" tabindex="0" style="width: 100%;" required></select>
|
||||
</div>
|
||||
<label for="DFNewAlias">Aliases</label>
|
||||
<div class="input-group">
|
||||
<input name="newAlias" id="DFNewAlias" type="text" class="form-control text" tabindex="0"><span class="input-group-btn"><button id="DFNewAliasAdd" class="btn" type="button">Add</button></span>
|
||||
</div>
|
||||
<div id="DFAliases" class="list-group" tabindex="0">
|
||||
<div class="col-sm-6">
|
||||
<label for="DFNewAlias">Aliases</label>
|
||||
<div class="input-group">
|
||||
<input name="newAlias" id="DFNewAlias" type="text" class="form-control text" tabindex="0"><span class="input-group-btn"><button id="DFNewAliasAdd" class="btn" type="button">Add</button></span>
|
||||
</div>
|
||||
<div id="DFAliases" class="form-control list-group" tabindex="0">
|
||||
</div>
|
||||
<!--<label>Prices</label>-->
|
||||
<!--<div class="input-group">-->
|
||||
<!--<span class="metric">8oz Jars</span> <span class="input-group-addon">$</span><input type="number" min="0.00" step="0.50" value="11.00" data-number-to-fixed="2" class="form-control currency" tabindex="0" required>-->
|
||||
<!--<span class="metric">16oz Jars</span> <span class="input-group-addon">$</span><input type="number" min="0.00" step="0.50" value="11.00" data-number-to-fixed="2" class="form-control currency" tabindex="0" required>-->
|
||||
<!--<span class="metric">32oz Jars</span> <span class="input-group-addon">$</span><input type="number" min="0.00" step="0.50" value="11.00" data-number-to-fixed="2" class="form-control currency" tabindex="0" required>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -125,7 +130,7 @@ $(function() {
|
||||
};
|
||||
|
||||
var $table = $page.find('#dataTable');
|
||||
var dataTable = new LinkedTable($table, {
|
||||
$table.buildTable({
|
||||
url: "data/Item/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
@@ -192,6 +197,8 @@ $(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
var dataTable = $table.getTable();
|
||||
|
||||
$page.find('#dataTable').on('dblclick', 'tr', function(event) {
|
||||
if(dataTable.getSelectedRow()) {
|
||||
location.hash = "#!/items-edit";
|
||||
@@ -264,7 +271,7 @@ $(function() {
|
||||
//Initialize the measures selector.
|
||||
$editorForm.find('#DFMeasures').select2({data: measureData}).focus(function() {$(this).select2('focus')});
|
||||
//Initialize the drop down menu.
|
||||
$editorForm.find("#DFSubcategory").buildEditableSelect(query1[0], {textAttr: 'name', listClass: 'comboList', groupFunctions: {
|
||||
$editorForm.find("#DFSubcategory").buildCombo(query1[0], {textAttr: 'name', listClass: 'comboList', groupFunctions: {
|
||||
groupParents: function(category) {
|
||||
return category;
|
||||
},
|
||||
@@ -315,9 +322,9 @@ $(function() {
|
||||
$editorView.find(".modal-title").text("Edit Item");
|
||||
//Reset fields to selected values.
|
||||
$editorView.find('#DFName').val(model.name);
|
||||
$editorView.find('#DFSubcategory').val(model.subcategoryId);
|
||||
$editorView.find('#DFSubcategoryId').val(model.subcategoryId).trigger("change");
|
||||
$editorView.find('#DFPrice').val(model.defaultPrice);
|
||||
$editorView.find('#DFMeasures').val(model.measures);
|
||||
$editorView.find('#DFMeasures').val(model.measures).trigger("change");
|
||||
$editorView.find('#DFAliases').empty();
|
||||
|
||||
if(model.aliases && model.aliases.length) {
|
||||
@@ -484,7 +491,7 @@ $(function() {
|
||||
switch(event.keyCode) {
|
||||
case 27:
|
||||
if(!event.isDefaultPrevented())
|
||||
location.href='#!/items';
|
||||
history.back();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,31 +4,33 @@
|
||||
// Takes a input form element and a hidden form element (to store the selected id in) along with an array of objects, to build a dropdown select control that allows the user to type part of the selection to filter the list.
|
||||
//
|
||||
(function($) {
|
||||
var EditableSelect = function($input, $hidden, data, options) {
|
||||
var Combo = function($input, $hidden, data, options) {
|
||||
var _this = this;
|
||||
|
||||
this.$input = $input;
|
||||
this.$hidden = $hidden;
|
||||
this.options = $.extend({}, EditableSelect.DEFAULTS, options);
|
||||
this.options = $.extend({}, Combo.DEFAULTS, options);
|
||||
this.$selected = null;
|
||||
this.$listContainer = $('<div/>', {style: 'position: relative; height: 0;'});
|
||||
this.$list = $('<ul/>', {role: 'menu', class: this.options.listClass});
|
||||
|
||||
//Ensure that if the hidden field exists and changes, that the hidden field's id matches the text in the input field. If not then the hidden id field was changed manually and externally and the text field should be updated.
|
||||
if(this.$hidden) {
|
||||
this.$hidden.on('change', function(event) {
|
||||
var id = _this.$hidden.val();
|
||||
var $li = _this.$list.children("[role!='node']");
|
||||
this.$hidden.on('change', hiddenInputChanged);
|
||||
}
|
||||
|
||||
for(var i = 0; i < $li.length; i++) {
|
||||
var $next = $($li[i]);
|
||||
function hiddenInputChanged() {
|
||||
var id = _this.$hidden.val();
|
||||
var $li = _this.$list.children("[role!='node']");
|
||||
|
||||
if($next.data('model').id == id) {
|
||||
if(_this.$input.val() != $next.text())
|
||||
_this.$input.val($next.text());
|
||||
}
|
||||
for(var i = 0; i < $li.length; i++) {
|
||||
var $next = $($li[i]);
|
||||
|
||||
if($next.data('model').id == id) {
|
||||
if(_this.$input.val() != $next.text())
|
||||
_this.$input.val($next.text());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//this.$list.appendTo($input.parent());
|
||||
@@ -176,9 +178,14 @@
|
||||
|
||||
//Add the initial set of data.
|
||||
add(data);
|
||||
|
||||
//Check the hidden input field for an ID, and setup the selection based in it if there is one.
|
||||
if(this.$hidden && _this.$hidden.val()) {
|
||||
hiddenInputChanged();
|
||||
}
|
||||
};
|
||||
|
||||
EditableSelect.DEFAULTS = {
|
||||
Combo.DEFAULTS = {
|
||||
textAttr: 'text', //The attribute of the data elements to use for the name. This can also be a function that takes the data object and returns the text.
|
||||
idAttr: 'id', //The attribute of the data elements to use for the ID. This can also be a function that takes the data obejct and returns the ID.
|
||||
// groupFunctions: The object containing three functions: 'groupParent', 'parentText', 'children'.
|
||||
@@ -189,15 +196,15 @@
|
||||
filter: true, //Whether to filter the list as the user types.
|
||||
effects: 'fade',
|
||||
duration: '200',
|
||||
listClass: 'editable-select-list',
|
||||
listClass: 'de.combo-list',
|
||||
selectionClass: 'selected' //The class to use for the selected element in the dropdown list.
|
||||
};
|
||||
|
||||
EditableSelect.prototype.select = function($li) {
|
||||
Combo.prototype.select = function($li) {
|
||||
if($li.length == 0) {
|
||||
if(this.$input.val() != '') {
|
||||
this.$input.val("")
|
||||
if(this.$hidden) this.$hidden.val(undefined);
|
||||
if(this.$hidden) this.$hidden.val(undefined).change();
|
||||
this.filter();
|
||||
//Note: Don't trigger the select event - for some reason it causes the dropdown to reopen and the control to retain focus when clicking out of the widget.
|
||||
}
|
||||
@@ -208,7 +215,10 @@
|
||||
//No need to change selection if the selection has not changed.
|
||||
if(this.$input.val() != $li.text()) {
|
||||
this.$input.val($li.text()); //Save the selected text into the text input.
|
||||
if(this.$hidden) this.$hidden.val($li.data('model')[this.options.idAttr]); //Save the ID into the hidden form input if it exists.
|
||||
if(this.$hidden) {
|
||||
this.$hidden.val($li.data('model')[this.options.idAttr]);
|
||||
this.$hidden.change();
|
||||
} //Save the ID into the hidden form input if it exists.
|
||||
this.hide();
|
||||
this.filter();
|
||||
//this.trigger('select', $li);
|
||||
@@ -217,7 +227,7 @@
|
||||
};
|
||||
|
||||
//Filters the list items by marking those that match the text in the text field as having the class 'visible'.
|
||||
EditableSelect.prototype.filter = function() {
|
||||
Combo.prototype.filter = function() {
|
||||
try {
|
||||
var search = this.$input.val();
|
||||
var _this = this;
|
||||
@@ -261,17 +271,17 @@
|
||||
}
|
||||
};
|
||||
|
||||
EditableSelect.prototype.focus = function() {
|
||||
Combo.prototype.focus = function() {
|
||||
this.show();
|
||||
this.$input.select();
|
||||
};
|
||||
|
||||
EditableSelect.prototype.blur = function() {
|
||||
Combo.prototype.blur = function() {
|
||||
this.hide();
|
||||
this.select(this.$list.find('li.selected'));
|
||||
};
|
||||
|
||||
EditableSelect.prototype.show = function() {
|
||||
Combo.prototype.show = function() {
|
||||
//Position the list relative to the edit field.
|
||||
this.$list.css({position: 'absolute', top: 0, left: 0, width: this.$input.outerWidth()});
|
||||
|
||||
@@ -285,7 +295,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
EditableSelect.prototype.hide = function() {
|
||||
Combo.prototype.hide = function() {
|
||||
var fns = {default: 'hide', fade: 'fadeOut', slide: 'slideUp'};
|
||||
var fn = fns[this.options.effects];
|
||||
|
||||
@@ -295,7 +305,7 @@
|
||||
};
|
||||
|
||||
// goDown: true/false - defaults to true - indicating whether the highlighting should go up or down if the requested item is a node. Nodes cannot be highlighted or selected.
|
||||
EditableSelect.prototype.highlight = function(index) {
|
||||
Combo.prototype.highlight = function(index) {
|
||||
var _this = this;
|
||||
|
||||
this.show();
|
||||
@@ -320,9 +330,9 @@
|
||||
});
|
||||
};
|
||||
|
||||
EditableSelect.prototype.trigger = function(event) {
|
||||
Combo.prototype.trigger = function(event) {
|
||||
var params = Array.prototype.slice.call(arguments, 1);
|
||||
var args = [event + '.editable-select'];
|
||||
var args = [event + '.de.combo'];
|
||||
|
||||
args.push(params);
|
||||
|
||||
@@ -330,17 +340,17 @@
|
||||
this.$input.trigger.apply(this.$input, args);
|
||||
};
|
||||
|
||||
$.fn.buildEditableSelect = function(data, options) {
|
||||
$.fn.buildCombo = function(data, options) {
|
||||
for(var index = 0; index < this.length; index++) {
|
||||
var $next = $(this[index]);
|
||||
var nextEditableSelect = new EditableSelect($next, $next.siblings('input[type=hidden]').first(), data, options);
|
||||
var nextCombo = new Combo($next, $next.siblings('input[type=hidden]').first(), data, options);
|
||||
|
||||
$next.data("editable-select", nextEditableSelect);
|
||||
$next.data("de.combo", nextCombo);
|
||||
}
|
||||
};
|
||||
$.fn.editableSelect = function() {
|
||||
$.fn.getCombo = function() {
|
||||
if(this.length > 0) {
|
||||
return $(this[0]).data('editable-select');
|
||||
return $(this[0]).data('de.combo');
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
@@ -74,12 +74,12 @@
|
||||
var $next = $(this[index]);
|
||||
var nextDropdown = new Dropdown($next, data, options);
|
||||
|
||||
$next.data("dropdown", nextDropdown);
|
||||
$next.data("de.dropdown", nextDropdown);
|
||||
}
|
||||
}
|
||||
$.fn.dropdown = function() {
|
||||
$.fn.getDropdown = function() {
|
||||
if(this.length > 0) {
|
||||
return $(this[0]).data('dropdown');
|
||||
return $(this[0]).data('de.dropdown');
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
@@ -1,12 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var LinkedTable;
|
||||
|
||||
+function($) {
|
||||
LinkedTable = function(element, options) {
|
||||
var Table = function(element, options) {
|
||||
var _this = this;
|
||||
this.$element = $(element);
|
||||
this.options = $.extend({}, LinkedTable.DEFAULTS, options);
|
||||
this.options = $.extend({}, Table.DEFAULTS, options);
|
||||
this.$selectedRow = null;
|
||||
this.selectionHandler = function(event) {
|
||||
if(this) {
|
||||
@@ -29,7 +27,9 @@ var LinkedTable;
|
||||
_this.options.selectionChanged(_this.$selectedRow, _this.$selectedRow ? _this.$selectedRow.data(_this.options.modelPropName) : null);
|
||||
}
|
||||
|
||||
return false;
|
||||
_this.$element.focus();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
//Takes a callback function with three parameters:
|
||||
@@ -188,7 +188,7 @@ var LinkedTable;
|
||||
};
|
||||
};
|
||||
|
||||
LinkedTable.DEFAULTS = {
|
||||
Table.DEFAULTS = {
|
||||
url: '', //The absolute or relative path to use to query the data. Server is expected to respond with a JSON array of objects.
|
||||
attr: 'data-key-name', //The attribute name used by the HTML <th></th> tags to specify either the model attribute used to fill the cells for the row, or the function that will update the cell data. The function should take three parameters: $cell, model, supportingData. $cell is the jquery wrapped <td></td> element. Model is the json model sent by the server for this row. SupportingData is a map of query results for supporting queries as setup when defining the table.
|
||||
modelPropName: 'model', //The property name to use when attaching the model to the table row. Not normally changed.
|
||||
@@ -206,12 +206,12 @@ var LinkedTable;
|
||||
parameters: null //Optional function that returns an object, or an object whose attributes are passed to the URL as parameters.
|
||||
};
|
||||
|
||||
LinkedTable.prototype.getSelectedRow = function() {
|
||||
Table.prototype.getSelectedRow = function() {
|
||||
return this.$selectedRow;
|
||||
};
|
||||
|
||||
//Refreshes the table data with updated server data. Does not clear the table or rebuild it.
|
||||
LinkedTable.prototype.refresh = function() {
|
||||
Table.prototype.refresh = function() {
|
||||
//Load the results from the server, then build the table.
|
||||
this.load.call(this, function(data, attributes, supportingData) {
|
||||
var $table = this.$element;
|
||||
@@ -263,7 +263,7 @@ var LinkedTable;
|
||||
|
||||
//A function that will clean and rebuild the table displaying all the users.
|
||||
//Note that each row of the table will have a data element attached to the table row. The key will be "model" and the value will be the object sent by the server.
|
||||
LinkedTable.prototype.build = function() {
|
||||
Table.prototype.build = function() {
|
||||
var table = this.$element;
|
||||
var thead = table.find("thead tr");
|
||||
var tbody = table.find("tbody");
|
||||
@@ -299,5 +299,42 @@ var LinkedTable;
|
||||
//Setup the row selection handler.
|
||||
if(selection == 'row') table.on('click', 'tbody tr', selectionHandler);
|
||||
});
|
||||
}
|
||||
|
||||
//This does not work: Cannot unregister the handler because we never get the notification that the table has been removed from the DOM. We could listen for all removals and find any that are any of the parents of this table, but that would be rediculously expensive.
|
||||
// //Handle any key event that bubbles back to the document while the page is being shown. This allows the table elements to be navigated without focusing the table.
|
||||
// var keyHandler = function(event) {
|
||||
// console.log(event.keyCode);
|
||||
// };
|
||||
// var parent = this.$element.parent()[0];
|
||||
// $(document).on('keyup', keyHandler);
|
||||
// var observer = new MutationObserver(function(mutations) {
|
||||
// for(var i = 0; i < mutations.length; i++) {
|
||||
// if(mutations[i].removedNodes && mutations[i].removedNodes.length) {
|
||||
// for(var n = 0; n < mutations[i].removedNodes.length; n++) {
|
||||
// if(mutations[i].removedNodes[n] == parent) {
|
||||
// $(document).off('keyup', keyHandler);
|
||||
// observer.disconnect();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// //Remove the key handler when the table is removed from the DOM.
|
||||
// observer.observe(parent, {childList: true, subtree: true});
|
||||
};
|
||||
|
||||
$.fn.buildTable = function(options) {
|
||||
for(var index = 0; index < this.length; index++) {
|
||||
var $next = $(this[index]);
|
||||
var nextTable = new Table($next, options);
|
||||
|
||||
$next.data("de.table", nextTable);
|
||||
nextTable.build();
|
||||
}
|
||||
};
|
||||
$.fn.getTable = function() {
|
||||
if(this.length > 0) {
|
||||
return $(this[0]).data('de.table');
|
||||
}
|
||||
};
|
||||
}(jQuery);
|
||||
11008
public/admin/js/jquery-1.12.4.js
vendored
Normal file
11008
public/admin/js/jquery-1.12.4.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
public/admin/js/jquery-1.12.4.min.js
vendored
Normal file
5
public/admin/js/jquery-1.12.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
702
public/admin/js/jquery-migrate-1.3.0.js
Normal file
702
public/admin/js/jquery-migrate-1.3.0.js
Normal file
@@ -0,0 +1,702 @@
|
||||
/*!
|
||||
* jQuery Migrate - v1.3.0 - 2016-01-13
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
*/
|
||||
(function( jQuery, window, undefined ) {
|
||||
// See http://bugs.jquery.com/ticket/13335
|
||||
// "use strict";
|
||||
|
||||
|
||||
jQuery.migrateVersion = "1.3.0";
|
||||
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to true to prevent console output; migrateWarnings still maintained
|
||||
// jQuery.migrateMute = false;
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
if ( !jQuery.migrateMute && window.console && window.console.log ) {
|
||||
window.console.log("JQMIGRATE: Logging is active");
|
||||
}
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
if ( Object.defineProperty ) {
|
||||
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
||||
// allow property to be overwritten in case some other plugin wants it
|
||||
try {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
});
|
||||
return;
|
||||
} catch( err ) {
|
||||
// IE8 is a dope about Object.defineProperty, can't warn there
|
||||
}
|
||||
}
|
||||
|
||||
// Non-ES5 (or broken) browser; just set the property
|
||||
jQuery._definePropertyBroken = true;
|
||||
obj[ prop ] = value;
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
// jQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
|
||||
oldAttr = jQuery.attr,
|
||||
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
||||
function() { return null; },
|
||||
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
||||
function() { return undefined; },
|
||||
rnoType = /^(?:input|button)$/i,
|
||||
rnoAttrNodeType = /^[238]$/,
|
||||
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||
ruseDefault = /^(?:checked|selected)$/i;
|
||||
|
||||
// jQuery.attrFn
|
||||
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
|
||||
|
||||
jQuery.attr = function( elem, name, value, pass ) {
|
||||
var lowerName = name.toLowerCase(),
|
||||
nType = elem && elem.nodeType;
|
||||
|
||||
if ( pass ) {
|
||||
// Since pass is used internally, we only warn for new jQuery
|
||||
// versions where there isn't a pass arg in the formal params
|
||||
if ( oldAttr.length < 4 ) {
|
||||
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
||||
}
|
||||
if ( elem && !rnoAttrNodeType.test( nType ) &&
|
||||
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
|
||||
return jQuery( elem )[ name ]( value );
|
||||
}
|
||||
}
|
||||
|
||||
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
||||
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
||||
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
||||
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
||||
}
|
||||
|
||||
// Restore boolHook for boolean property/attribute synchronization
|
||||
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
||||
jQuery.attrHooks[ lowerName ] = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
// Fall back to attribute presence where some booleans are not supported
|
||||
var attrNode,
|
||||
property = jQuery.prop( elem, name );
|
||||
return property === true || typeof property !== "boolean" &&
|
||||
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
||||
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
set: function( elem, value, name ) {
|
||||
var propName;
|
||||
if ( value === false ) {
|
||||
// Remove boolean attributes when set to false
|
||||
jQuery.removeAttr( elem, name );
|
||||
} else {
|
||||
// value is true since we know at this point it's type boolean and not false
|
||||
// Set boolean attributes to the same name and set the DOM property
|
||||
propName = jQuery.propFix[ name ] || name;
|
||||
if ( propName in elem ) {
|
||||
// Only set the IDL specifically if it already exists on the element
|
||||
elem[ propName ] = true;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, name.toLowerCase() );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
// Warn only for attributes that can remain distinct from their properties post-1.9
|
||||
if ( ruseDefault.test( lowerName ) ) {
|
||||
migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldAttr.call( jQuery, elem, name, value );
|
||||
};
|
||||
|
||||
// attrHooks: value
|
||||
jQuery.attrHooks.value = {
|
||||
get: function( elem, name ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrGet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
||||
}
|
||||
return name in elem ?
|
||||
elem.value :
|
||||
null;
|
||||
},
|
||||
set: function( elem, value ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrSet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
||||
}
|
||||
// Does not return so that setAttribute is also used
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var matched, browser,
|
||||
oldInit = jQuery.fn.init,
|
||||
oldParseJSON = jQuery.parseJSON,
|
||||
rspaceAngle = /^\s*</,
|
||||
// Note: XSS check is done below after string is trimmed
|
||||
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
|
||||
|
||||
// $(html) "looks like html" rule change
|
||||
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
||||
var match, ret;
|
||||
|
||||
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
||||
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
|
||||
// This is an HTML string according to the "old" rules; is it still?
|
||||
if ( !rspaceAngle.test( selector ) ) {
|
||||
migrateWarn("$(html) HTML strings must start with '<' character");
|
||||
}
|
||||
if ( match[ 3 ] ) {
|
||||
migrateWarn("$(html) HTML text after last tag is ignored");
|
||||
}
|
||||
|
||||
// Consistently reject any HTML-like string starting with a hash (#9521)
|
||||
// Note that this may break jQuery 1.6.x code that otherwise would work.
|
||||
if ( match[ 0 ].charAt( 0 ) === "#" ) {
|
||||
migrateWarn("HTML string cannot start with a '#' character");
|
||||
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
|
||||
}
|
||||
// Now process using loose rules; let pre-1.8 play too
|
||||
if ( context && context.context ) {
|
||||
// jQuery object as context; parseHTML expects a DOM object
|
||||
context = context.context;
|
||||
}
|
||||
if ( jQuery.parseHTML ) {
|
||||
return oldInit.call( this,
|
||||
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
|
||||
context || document, true ), context, rootjQuery );
|
||||
}
|
||||
}
|
||||
|
||||
// jQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
|
||||
if ( selector === "#" ) {
|
||||
migrateWarn( "jQuery( '#' ) is not a valid selector" );
|
||||
selector = [];
|
||||
}
|
||||
|
||||
ret = oldInit.apply( this, arguments );
|
||||
|
||||
// Fill in selector and context properties so .live() works
|
||||
if ( selector && selector.selector !== undefined ) {
|
||||
// A jQuery object, copy its properties
|
||||
ret.selector = selector.selector;
|
||||
ret.context = selector.context;
|
||||
|
||||
} else {
|
||||
ret.selector = typeof selector === "string" ? selector : "";
|
||||
if ( selector ) {
|
||||
ret.context = selector.nodeType? selector : context || document;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
// Let $.parseJSON(falsy_value) return null
|
||||
jQuery.parseJSON = function( json ) {
|
||||
if ( !json ) {
|
||||
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
||||
return null;
|
||||
}
|
||||
return oldParseJSON.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
// Don't clobber any existing jQuery.browser in case it's different
|
||||
if ( !jQuery.browser ) {
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
}
|
||||
|
||||
// Warn if the code tries to get jQuery.browser
|
||||
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
||||
|
||||
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
|
||||
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
|
||||
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
|
||||
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
|
||||
|
||||
jQuery.sub = function() {
|
||||
function jQuerySub( selector, context ) {
|
||||
return new jQuerySub.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySub, this );
|
||||
jQuerySub.superclass = this;
|
||||
jQuerySub.fn = jQuerySub.prototype = this();
|
||||
jQuerySub.fn.constructor = jQuerySub;
|
||||
jQuerySub.sub = this.sub;
|
||||
jQuerySub.fn.init = function init( selector, context ) {
|
||||
var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||
return instance instanceof jQuerySub ?
|
||||
instance :
|
||||
jQuerySub( instance );
|
||||
};
|
||||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||
var rootjQuerySub = jQuerySub(document);
|
||||
migrateWarn( "jQuery.sub() is deprecated" );
|
||||
return jQuerySub;
|
||||
};
|
||||
|
||||
// The number of elements contained in the matched element set
|
||||
jQuery.fn.size = function() {
|
||||
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
|
||||
return this.length;
|
||||
};
|
||||
|
||||
|
||||
var internalSwapCall = false;
|
||||
|
||||
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
||||
if ( jQuery.swap ) {
|
||||
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
||||
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
||||
|
||||
if ( oldHook ) {
|
||||
jQuery.cssHooks[ name ].get = function() {
|
||||
var ret;
|
||||
|
||||
internalSwapCall = true;
|
||||
ret = oldHook.apply( this, arguments );
|
||||
internalSwapCall = false;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery.swap = function( elem, options, callback, args ) {
|
||||
var ret, name,
|
||||
old = {};
|
||||
|
||||
if ( !internalSwapCall ) {
|
||||
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Remember the old values, and insert the new ones
|
||||
for ( name in options ) {
|
||||
old[ name ] = elem.style[ name ];
|
||||
elem.style[ name ] = options[ name ];
|
||||
}
|
||||
|
||||
ret = callback.apply( elem, args || [] );
|
||||
|
||||
// Revert the old values
|
||||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
||||
jQuery.ajaxSetup({
|
||||
converters: {
|
||||
"text json": jQuery.parseJSON
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var oldFnData = jQuery.fn.data;
|
||||
|
||||
jQuery.fn.data = function( name ) {
|
||||
var ret, evt,
|
||||
elem = this[0];
|
||||
|
||||
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
||||
if ( elem && name === "events" && arguments.length === 1 ) {
|
||||
ret = jQuery.data( elem, name );
|
||||
evt = jQuery._data( elem, name );
|
||||
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
||||
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
return oldFnData.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var rscriptType = /\/(java|ecma)script/i;
|
||||
|
||||
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
||||
if ( !jQuery.clean ) {
|
||||
jQuery.clean = function( elems, context, fragment, scripts ) {
|
||||
// Set context per 1.8 logic
|
||||
context = context || document;
|
||||
context = !context.nodeType && context[0] || context;
|
||||
context = context.ownerDocument || context;
|
||||
|
||||
migrateWarn("jQuery.clean() is deprecated");
|
||||
|
||||
var i, elem, handleScript, jsTags,
|
||||
ret = [];
|
||||
|
||||
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
||||
|
||||
// Complex logic lifted directly from jQuery 1.8
|
||||
if ( fragment ) {
|
||||
// Special handling of each script element
|
||||
handleScript = function( elem ) {
|
||||
// Check if we consider it executable
|
||||
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
||||
// Detach the script and store it in the scripts array (if provided) or the fragment
|
||||
// Return truthy to indicate that it has been handled
|
||||
return scripts ?
|
||||
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
||||
fragment.appendChild( elem );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
||||
// Check if we're done after handling an executable script
|
||||
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
||||
// Append to fragment and handle embedded scripts
|
||||
fragment.appendChild( elem );
|
||||
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
||||
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
||||
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
||||
|
||||
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
||||
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||
i += jsTags.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
var eventAdd = jQuery.event.add,
|
||||
eventRemove = jQuery.event.remove,
|
||||
eventTrigger = jQuery.event.trigger,
|
||||
oldToggle = jQuery.fn.toggle,
|
||||
oldLive = jQuery.fn.live,
|
||||
oldDie = jQuery.fn.die,
|
||||
oldLoad = jQuery.fn.load,
|
||||
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
||||
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
||||
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
||||
hoverHack = function( events ) {
|
||||
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
|
||||
return events;
|
||||
}
|
||||
if ( rhoverHack.test( events ) ) {
|
||||
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
||||
}
|
||||
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
||||
};
|
||||
|
||||
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
||||
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
||||
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
||||
}
|
||||
|
||||
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
||||
if ( jQuery.event.dispatch ) {
|
||||
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Support for 'hover' pseudo-event and ajax event warnings
|
||||
jQuery.event.add = function( elem, types, handler, data, selector ){
|
||||
if ( elem !== document && rajaxEvent.test( types ) ) {
|
||||
migrateWarn( "AJAX events should be attached to document: " + types );
|
||||
}
|
||||
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
||||
};
|
||||
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
||||
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
||||
};
|
||||
|
||||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
||||
|
||||
jQuery.fn[ name ] = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0 );
|
||||
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
||||
|
||||
// If this is an ajax load() the first arg should be the string URL;
|
||||
// technically this could also be the "Anything" arg of the event .load()
|
||||
// which just goes to show why this dumb signature has been deprecated!
|
||||
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
||||
if ( name === "load" && typeof arguments[ 0 ] === "string" ) {
|
||||
return oldLoad.apply( this, arguments );
|
||||
}
|
||||
|
||||
args.splice( 0, 0, name );
|
||||
if ( arguments.length ) {
|
||||
return this.bind.apply( this, args );
|
||||
}
|
||||
|
||||
// Use .triggerHandler here because:
|
||||
// - load and unload events don't need to bubble, only applied to window or image
|
||||
// - error event should not bubble to window, although it does pre-1.7
|
||||
// See http://bugs.jquery.com/ticket/11820
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
jQuery.fn.toggle = function( fn, fn2 ) {
|
||||
|
||||
// Don't mess with animation or css toggles
|
||||
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
||||
return oldToggle.apply( this, arguments );
|
||||
}
|
||||
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
||||
|
||||
// Save reference to arguments for access in closure
|
||||
var args = arguments,
|
||||
guid = fn.guid || jQuery.guid++,
|
||||
i = 0,
|
||||
toggler = function( event ) {
|
||||
// Figure out which function to execute
|
||||
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
||||
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
||||
|
||||
// Make sure that clicks stop
|
||||
event.preventDefault();
|
||||
|
||||
// and execute the function
|
||||
return args[ lastToggle ].apply( this, arguments ) || false;
|
||||
};
|
||||
|
||||
// link all the functions, so any of them can unbind this click handler
|
||||
toggler.guid = guid;
|
||||
while ( i < args.length ) {
|
||||
args[ i++ ].guid = guid;
|
||||
}
|
||||
|
||||
return this.click( toggler );
|
||||
};
|
||||
|
||||
jQuery.fn.live = function( types, data, fn ) {
|
||||
migrateWarn("jQuery.fn.live() is deprecated");
|
||||
if ( oldLive ) {
|
||||
return oldLive.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).on( types, this.selector, data, fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.die = function( types, fn ) {
|
||||
migrateWarn("jQuery.fn.die() is deprecated");
|
||||
if ( oldDie ) {
|
||||
return oldDie.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).off( types, this.selector || "**", fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
// Turn global events into document-triggered events
|
||||
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
||||
if ( !elem && !rajaxEvent.test( event ) ) {
|
||||
migrateWarn( "Global events are undocumented and deprecated" );
|
||||
}
|
||||
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
||||
};
|
||||
jQuery.each( ajaxEvents.split("|"),
|
||||
function( _, name ) {
|
||||
jQuery.event.special[ name ] = {
|
||||
setup: function() {
|
||||
var elem = this;
|
||||
|
||||
// The document needs no shimming; must be !== for oldIE
|
||||
if ( elem !== document ) {
|
||||
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
||||
jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
|
||||
});
|
||||
jQuery._data( this, name, jQuery.guid++ );
|
||||
}
|
||||
return false;
|
||||
},
|
||||
teardown: function() {
|
||||
if ( this !== document ) {
|
||||
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
jQuery.event.special.ready = {
|
||||
setup: function() { migrateWarn( "'ready' event is deprecated" ); }
|
||||
};
|
||||
|
||||
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
|
||||
oldFind = jQuery.fn.find;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.fn.find = function( selector ) {
|
||||
var ret = oldFind.apply( this, arguments );
|
||||
ret.context = this.context;
|
||||
ret.selector = this.selector ? this.selector + " " + selector : selector;
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
// jQuery 1.6 did not support Callbacks, do not warn there
|
||||
if ( jQuery.Callbacks ) {
|
||||
|
||||
var oldDeferred = jQuery.Deferred,
|
||||
tuples = [
|
||||
// action, add listener, callbacks, .then handlers, final state
|
||||
[ "resolve", "done", jQuery.Callbacks("once memory"),
|
||||
jQuery.Callbacks("once memory"), "resolved" ],
|
||||
[ "reject", "fail", jQuery.Callbacks("once memory"),
|
||||
jQuery.Callbacks("once memory"), "rejected" ],
|
||||
[ "notify", "progress", jQuery.Callbacks("memory"),
|
||||
jQuery.Callbacks("memory") ]
|
||||
];
|
||||
|
||||
jQuery.Deferred = function( func ) {
|
||||
var deferred = oldDeferred(),
|
||||
promise = deferred.promise();
|
||||
|
||||
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
||||
var fns = arguments;
|
||||
|
||||
migrateWarn( "deferred.pipe() is deprecated" );
|
||||
|
||||
return jQuery.Deferred(function( newDefer ) {
|
||||
jQuery.each( tuples, function( i, tuple ) {
|
||||
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
||||
// deferred.done(function() { bind to newDefer or newDefer.resolve })
|
||||
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
||||
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
||||
deferred[ tuple[1] ](function() {
|
||||
var returned = fn && fn.apply( this, arguments );
|
||||
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
||||
returned.promise()
|
||||
.done( newDefer.resolve )
|
||||
.fail( newDefer.reject )
|
||||
.progress( newDefer.notify );
|
||||
} else {
|
||||
newDefer[ tuple[ 0 ] + "With" ](
|
||||
this === promise ? newDefer.promise() : this,
|
||||
fn ? [ returned ] : arguments
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
fns = null;
|
||||
}).promise();
|
||||
|
||||
};
|
||||
|
||||
deferred.isResolved = function() {
|
||||
migrateWarn( "deferred.isResolved is deprecated" );
|
||||
return deferred.state() === "resolved";
|
||||
};
|
||||
|
||||
deferred.isRejected = function() {
|
||||
migrateWarn( "deferred.isRejected is deprecated" );
|
||||
return deferred.state() === "rejected";
|
||||
};
|
||||
|
||||
if ( func ) {
|
||||
func.call( deferred, deferred );
|
||||
}
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
})( jQuery, window );
|
||||
2
public/admin/js/jquery-migrate-1.3.0.min.js
vendored
Normal file
2
public/admin/js/jquery-migrate-1.3.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
540
public/admin/js/jquery-migrate-3.0.0.js
Normal file
540
public/admin/js/jquery-migrate-3.0.0.js
Normal file
@@ -0,0 +1,540 @@
|
||||
/*!
|
||||
* jQuery Migrate - v3.0.0 - 2016-06-09
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
*/
|
||||
(function( jQuery, window ) {
|
||||
"use strict";
|
||||
|
||||
|
||||
jQuery.migrateVersion = "3.0.0";
|
||||
|
||||
|
||||
( function() {
|
||||
|
||||
// Support: IE9 only
|
||||
// IE9 only creates console object when dev tools are first opened
|
||||
// Also, avoid Function#bind here to simplify PhantomJS usage
|
||||
var log = window.console && window.console.log &&
|
||||
function() { window.console.log.apply( window.console, arguments ); },
|
||||
rbadVersions = /^[12]\./;
|
||||
|
||||
if ( !log ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Need jQuery 3.0.0+ and no older Migrate loaded
|
||||
if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) {
|
||||
log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
|
||||
}
|
||||
if ( jQuery.migrateWarnings ) {
|
||||
log( "JQMIGRATE: Migrate plugin loaded multiple times" );
|
||||
}
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
log( "JQMIGRATE: Migrate is installed" +
|
||||
( jQuery.migrateMute ? "" : " with logging active" ) +
|
||||
", version " + jQuery.migrateVersion );
|
||||
|
||||
} )();
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg ) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
|
||||
// JQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var oldInit = jQuery.fn.init,
|
||||
oldIsNumeric = jQuery.isNumeric,
|
||||
oldFind = jQuery.find,
|
||||
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
|
||||
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;
|
||||
|
||||
jQuery.fn.init = function( arg1 ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
if ( typeof arg1 === "string" && arg1 === "#" ) {
|
||||
|
||||
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
|
||||
migrateWarn( "jQuery( '#' ) is not a valid selector" );
|
||||
args[ 0 ] = [];
|
||||
}
|
||||
|
||||
return oldInit.apply( this, args );
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
jQuery.find = function( selector ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
// Support: PhantomJS 1.x
|
||||
// String#match fails to match when used with a //g RegExp, only on some strings
|
||||
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
|
||||
|
||||
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
|
||||
// First see if qS thinks it's a valid selector, if so avoid a false positive
|
||||
try {
|
||||
document.querySelector( selector );
|
||||
} catch ( err1 ) {
|
||||
|
||||
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
|
||||
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
|
||||
return "[" + attr + op + "\"" + value + "\"]";
|
||||
} );
|
||||
|
||||
// If the regexp *may* have created an invalid selector, don't update it
|
||||
// Note that there may be false alarms if selector uses jQuery extensions
|
||||
try {
|
||||
document.querySelector( selector );
|
||||
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
|
||||
args[ 0 ] = selector;
|
||||
} catch ( err2 ) {
|
||||
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oldFind.apply( this, args );
|
||||
};
|
||||
|
||||
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
|
||||
var findProp;
|
||||
for ( findProp in oldFind ) {
|
||||
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
|
||||
jQuery.find[ findProp ] = oldFind[ findProp ];
|
||||
}
|
||||
}
|
||||
|
||||
// The number of elements contained in the matched element set
|
||||
jQuery.fn.size = function() {
|
||||
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
|
||||
return this.length;
|
||||
};
|
||||
|
||||
jQuery.parseJSON = function() {
|
||||
migrateWarn( "jQuery.parseJSON is deprecated; use JSON.parse" );
|
||||
return JSON.parse.apply( null, arguments );
|
||||
};
|
||||
|
||||
jQuery.isNumeric = function( val ) {
|
||||
|
||||
// The jQuery 2.2.3 implementation of isNumeric
|
||||
function isNumeric2( obj ) {
|
||||
var realStringObj = obj && obj.toString();
|
||||
return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
|
||||
}
|
||||
|
||||
var newValue = oldIsNumeric( val ),
|
||||
oldValue = isNumeric2( val );
|
||||
|
||||
if ( newValue !== oldValue ) {
|
||||
migrateWarn( "jQuery.isNumeric() should not be called on constructed objects" );
|
||||
}
|
||||
|
||||
return oldValue;
|
||||
};
|
||||
|
||||
migrateWarnProp( jQuery, "unique", jQuery.uniqueSort,
|
||||
"jQuery.unique is deprecated, use jQuery.uniqueSort" );
|
||||
|
||||
// Now jQuery.expr.pseudos is the standard incantation
|
||||
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
|
||||
"jQuery.expr.filters is now jQuery.expr.pseudos" );
|
||||
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
|
||||
"jQuery.expr[\":\"] is now jQuery.expr.pseudos" );
|
||||
|
||||
|
||||
var oldAjax = jQuery.ajax;
|
||||
|
||||
jQuery.ajax = function( ) {
|
||||
var jQXHR = oldAjax.apply( this, arguments );
|
||||
|
||||
// Be sure we got a jQXHR (e.g., not sync)
|
||||
if ( jQXHR.promise ) {
|
||||
migrateWarnProp( jQXHR, "success", jQXHR.done,
|
||||
"jQXHR.success is deprecated and removed" );
|
||||
migrateWarnProp( jQXHR, "error", jQXHR.fail,
|
||||
"jQXHR.error is deprecated and removed" );
|
||||
migrateWarnProp( jQXHR, "complete", jQXHR.always,
|
||||
"jQXHR.complete is deprecated and removed" );
|
||||
}
|
||||
|
||||
return jQXHR;
|
||||
};
|
||||
|
||||
|
||||
var oldRemoveAttr = jQuery.fn.removeAttr,
|
||||
oldToggleClass = jQuery.fn.toggleClass,
|
||||
rmatchNonSpace = /\S+/g;
|
||||
|
||||
jQuery.fn.removeAttr = function( name ) {
|
||||
var self = this;
|
||||
|
||||
jQuery.each( name.match( rmatchNonSpace ), function( i, attr ) {
|
||||
if ( jQuery.expr.match.bool.test( attr ) ) {
|
||||
migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
|
||||
self.prop( attr, false );
|
||||
}
|
||||
} );
|
||||
|
||||
return oldRemoveAttr.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.fn.toggleClass = function( state ) {
|
||||
|
||||
// Only deprecating no-args or single boolean arg
|
||||
if ( state !== undefined && typeof state !== "boolean" ) {
|
||||
return oldToggleClass.apply( this, arguments );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
|
||||
|
||||
// Toggle entire class name of each element
|
||||
return this.each( function() {
|
||||
var className = this.getAttribute && this.getAttribute( "class" ) || "";
|
||||
|
||||
if ( className ) {
|
||||
jQuery.data( this, "__className__", className );
|
||||
}
|
||||
|
||||
// If the element has a class name or if we're passed `false`,
|
||||
// then remove the whole classname (if there was one, the above saved it).
|
||||
// Otherwise bring back whatever was previously saved (if anything),
|
||||
// falling back to the empty string if nothing was stored.
|
||||
if ( this.setAttribute ) {
|
||||
this.setAttribute( "class",
|
||||
className || state === false ?
|
||||
"" :
|
||||
jQuery.data( this, "__className__" ) || ""
|
||||
);
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
var internalSwapCall = false;
|
||||
|
||||
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
||||
if ( jQuery.swap ) {
|
||||
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
||||
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
||||
|
||||
if ( oldHook ) {
|
||||
jQuery.cssHooks[ name ].get = function() {
|
||||
var ret;
|
||||
|
||||
internalSwapCall = true;
|
||||
ret = oldHook.apply( this, arguments );
|
||||
internalSwapCall = false;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
jQuery.swap = function( elem, options, callback, args ) {
|
||||
var ret, name,
|
||||
old = {};
|
||||
|
||||
if ( !internalSwapCall ) {
|
||||
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Remember the old values, and insert the new ones
|
||||
for ( name in options ) {
|
||||
old[ name ] = elem.style[ name ];
|
||||
elem.style[ name ] = options[ name ];
|
||||
}
|
||||
|
||||
ret = callback.apply( elem, args || [] );
|
||||
|
||||
// Revert the old values
|
||||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
var oldData = jQuery.data;
|
||||
|
||||
jQuery.data = function( elem, name, value ) {
|
||||
var curData;
|
||||
|
||||
// If the name is transformed, look for the un-transformed name in the data object
|
||||
if ( name && name !== jQuery.camelCase( name ) ) {
|
||||
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
|
||||
if ( curData && name in curData ) {
|
||||
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
|
||||
if ( arguments.length > 2 ) {
|
||||
curData[ name ] = value;
|
||||
}
|
||||
return curData[ name ];
|
||||
}
|
||||
}
|
||||
|
||||
return oldData.apply( this, arguments );
|
||||
};
|
||||
|
||||
var oldTweenRun = jQuery.Tween.prototype.run;
|
||||
|
||||
jQuery.Tween.prototype.run = function( percent ) {
|
||||
if ( jQuery.easing[ this.easing ].length > 1 ) {
|
||||
migrateWarn(
|
||||
"easing function " +
|
||||
"\"jQuery.easing." + this.easing.toString() +
|
||||
"\" should use only first argument"
|
||||
);
|
||||
|
||||
jQuery.easing[ this.easing ] = jQuery.easing[ this.easing ].bind(
|
||||
jQuery.easing,
|
||||
percent, this.options.duration * percent, 0, 1, this.options.duration
|
||||
);
|
||||
}
|
||||
|
||||
oldTweenRun.apply( this, arguments );
|
||||
};
|
||||
|
||||
var oldLoad = jQuery.fn.load,
|
||||
originalFix = jQuery.event.fix;
|
||||
|
||||
jQuery.event.props = [];
|
||||
jQuery.event.fixHooks = {};
|
||||
|
||||
jQuery.event.fix = function( originalEvent ) {
|
||||
var event,
|
||||
type = originalEvent.type,
|
||||
fixHook = this.fixHooks[ type ],
|
||||
props = jQuery.event.props;
|
||||
|
||||
if ( props.length ) {
|
||||
migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( fixHook && !fixHook._migrated_ ) {
|
||||
fixHook._migrated_ = true;
|
||||
migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
|
||||
if ( ( props = fixHook.props ) && props.length ) {
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event = originalFix.call( this, originalEvent );
|
||||
|
||||
return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
||||
};
|
||||
|
||||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
||||
|
||||
jQuery.fn[ name ] = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0 );
|
||||
|
||||
// If this is an ajax load() the first arg should be the string URL;
|
||||
// technically this could also be the "Anything" arg of the event .load()
|
||||
// which just goes to show why this dumb signature has been deprecated!
|
||||
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
||||
if ( name === "load" && typeof args[ 0 ] === "string" ) {
|
||||
return oldLoad.apply( this, args );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
||||
|
||||
args.splice( 0, 0, name );
|
||||
if ( arguments.length ) {
|
||||
return this.on.apply( this, args );
|
||||
}
|
||||
|
||||
// Use .triggerHandler here because:
|
||||
// - load and unload events don't need to bubble, only applied to window or image
|
||||
// - error event should not bubble to window, although it does pre-1.7
|
||||
// See http://bugs.jquery.com/ticket/11820
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
} );
|
||||
|
||||
// Trigger "ready" event only once, on document ready
|
||||
jQuery( function() {
|
||||
jQuery( document ).triggerHandler( "ready" );
|
||||
} );
|
||||
|
||||
jQuery.event.special.ready = {
|
||||
setup: function() {
|
||||
if ( this === document ) {
|
||||
migrateWarn( "'ready' event is deprecated" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.fn.extend( {
|
||||
|
||||
bind: function( types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.bind() is deprecated" );
|
||||
return this.on( types, null, data, fn );
|
||||
},
|
||||
unbind: function( types, fn ) {
|
||||
migrateWarn( "jQuery.fn.unbind() is deprecated" );
|
||||
return this.off( types, null, fn );
|
||||
},
|
||||
delegate: function( selector, types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.delegate() is deprecated" );
|
||||
return this.on( types, selector, data, fn );
|
||||
},
|
||||
undelegate: function( selector, types, fn ) {
|
||||
migrateWarn( "jQuery.fn.undelegate() is deprecated" );
|
||||
return arguments.length === 1 ?
|
||||
this.off( selector, "**" ) :
|
||||
this.off( types, selector || "**", fn );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
var oldOffset = jQuery.fn.offset;
|
||||
|
||||
jQuery.fn.offset = function() {
|
||||
var docElem,
|
||||
elem = this[ 0 ],
|
||||
origin = { top: 0, left: 0 };
|
||||
|
||||
if ( !elem || !elem.nodeType ) {
|
||||
migrateWarn( "jQuery.fn.offset() requires a valid DOM element" );
|
||||
return origin;
|
||||
}
|
||||
|
||||
docElem = ( elem.ownerDocument || document ).documentElement;
|
||||
if ( !jQuery.contains( docElem, elem ) ) {
|
||||
migrateWarn( "jQuery.fn.offset() requires an element connected to a document" );
|
||||
return origin;
|
||||
}
|
||||
|
||||
return oldOffset.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var oldParam = jQuery.param;
|
||||
|
||||
jQuery.param = function( data, traditional ) {
|
||||
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
|
||||
|
||||
if ( traditional === undefined && ajaxTraditional ) {
|
||||
|
||||
migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
|
||||
traditional = ajaxTraditional;
|
||||
}
|
||||
|
||||
return oldParam.call( this, data, traditional );
|
||||
};
|
||||
|
||||
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn( "jQuery.fn.andSelf() replaced by jQuery.fn.addBack()" );
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var oldDeferred = jQuery.Deferred,
|
||||
tuples = [
|
||||
|
||||
// Action, add listener, callbacks, .then handlers, final state
|
||||
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "resolved" ],
|
||||
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "rejected" ],
|
||||
[ "notify", "progress", jQuery.Callbacks( "memory" ),
|
||||
jQuery.Callbacks( "memory" ) ]
|
||||
];
|
||||
|
||||
jQuery.Deferred = function( func ) {
|
||||
var deferred = oldDeferred(),
|
||||
promise = deferred.promise();
|
||||
|
||||
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
||||
var fns = arguments;
|
||||
|
||||
migrateWarn( "deferred.pipe() is deprecated" );
|
||||
|
||||
return jQuery.Deferred( function( newDefer ) {
|
||||
jQuery.each( tuples, function( i, tuple ) {
|
||||
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
||||
|
||||
// Deferred.done(function() { bind to newDefer or newDefer.resolve })
|
||||
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
||||
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
||||
deferred[ tuple[ 1 ] ]( function() {
|
||||
var returned = fn && fn.apply( this, arguments );
|
||||
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
||||
returned.promise()
|
||||
.done( newDefer.resolve )
|
||||
.fail( newDefer.reject )
|
||||
.progress( newDefer.notify );
|
||||
} else {
|
||||
newDefer[ tuple[ 0 ] + "With" ](
|
||||
this === promise ? newDefer.promise() : this,
|
||||
fn ? [ returned ] : arguments
|
||||
);
|
||||
}
|
||||
} );
|
||||
} );
|
||||
fns = null;
|
||||
} ).promise();
|
||||
|
||||
};
|
||||
|
||||
if ( func ) {
|
||||
func.call( deferred, deferred );
|
||||
}
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
|
||||
|
||||
})( jQuery, window );
|
||||
2
public/admin/js/jquery-migrate-3.0.0.min.js
vendored
Normal file
2
public/admin/js/jquery-migrate-3.0.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2508
public/admin/js/jsgrid.js
Normal file
2508
public/admin/js/jsgrid.js
Normal file
File diff suppressed because it is too large
Load Diff
8
public/admin/js/jsgrid.min.js
vendored
Normal file
8
public/admin/js/jsgrid.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -104,7 +104,8 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
var dataTable = new LinkedTable($page.find('#dataTable'), {
|
||||
var $table = $page.find('#dataTable');
|
||||
$table.buildTable({
|
||||
url: "data/Measure/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
@@ -127,15 +128,14 @@ $(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
var dataTable = $table.getTable();
|
||||
|
||||
$page.find('#dataTable').on('dblclick', 'tr', function(event) {
|
||||
if(dataTable.getSelectedRow()) {
|
||||
location.hash = "#!/measures-edit";
|
||||
}
|
||||
});
|
||||
|
||||
//Call the refresh user table function once initially.
|
||||
dataTable.build();
|
||||
|
||||
//Refresh the data table if the user toggles the button to show/hide deleted elements.
|
||||
$page.find('#includeDeletedToggle').on('click', function(event) {
|
||||
dataTable.refresh();
|
||||
@@ -240,6 +240,16 @@ $(function() {
|
||||
$editorView.find('#DFName').focus();
|
||||
});
|
||||
|
||||
//Close the view if the user uses the escape key and it isn't handled at the widget level.
|
||||
$editorView.on('keyup', function(event) {
|
||||
switch(event.keyCode) {
|
||||
case 27:
|
||||
if(!event.isDefaultPrevented())
|
||||
history.back();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++ Delete View +++++++++++
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
<i class="fa fa-usd"></i>
|
||||
<p>Sales</p>
|
||||
</a>
|
||||
<a class="option" href="#!/prices">
|
||||
<i class="fa fa-usd"></i>
|
||||
<p>Prices</p>
|
||||
</a>
|
||||
<a class="option" href="#!/items">
|
||||
<i class="fa fa-sitemap"></i>
|
||||
<p>Items</p>
|
||||
|
||||
81
public/admin/prices.html
Normal file
81
public/admin/prices.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<div id="prices" class="page">
|
||||
<div id="gridView" class="view">
|
||||
<div class="measureSelectionContainer">
|
||||
<h1><span class="fa fa-sitemap"></span> Prices</h1>
|
||||
<label for="DFMeasure">Measure</label>
|
||||
<div class="form-group">
|
||||
<select id="DFMeasure" class="form-control" tabindex="0">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dataTable">
|
||||
</div>
|
||||
<div class="priceEditorContainer">
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">$</span><input id="DFPrice" type="number" min="0.00" step="0.50" value="11.00" data-number-to-fixed="2" class="form-control currency" tabindex="0" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"><button id="changePriceBtn" type="button" class="btn btn-default btn-primary btn-md" tabindex="0">Apply</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">//# sourceURL=prices.html
|
||||
$(function() {
|
||||
var numPattern = /^\d+/;
|
||||
var $page = $('#prices');
|
||||
var $measure = $page.find("#DFMeasure");
|
||||
var $changePriceBtn = $page.find("#changePriceBtn");
|
||||
|
||||
//Update the dialog drop downs when the queries finish.
|
||||
$.when.apply($, [$.get("data/Measure/readAll", {request: JSON.stringify({order: ['id', ['id']]})})]).then(function(query1) {
|
||||
//Initialize the drop down menu.
|
||||
//$page.find("#DFMeasure").buildCombo(query1, {textAttr: 'name', listClass: 'comboList'});
|
||||
// query1.sort(function(a, b) {
|
||||
// a.id > b.id ? 1 : -1;
|
||||
// });
|
||||
|
||||
for(var i = 0; i < query1.length; i++) {
|
||||
var next = query1[i];
|
||||
var $opt = $('<option/>', {id: next.id, text: next.name});
|
||||
|
||||
$opt.appendTo($measure);
|
||||
}
|
||||
});
|
||||
|
||||
$changePriceBtn.disable(true);
|
||||
$measure.change(function() {
|
||||
var id = $measure.val();
|
||||
|
||||
//TODO: Update the data table with items that use the given measure.
|
||||
$table.jsGrid('loadData', id);
|
||||
});
|
||||
|
||||
var $table = $page.find('#dataTable');
|
||||
$table.jsGrid({
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
heading: true,
|
||||
selecting: true,
|
||||
inserting: false,
|
||||
editing: false,
|
||||
sorting: true,
|
||||
paging: false,
|
||||
fields: [
|
||||
{name: "Item", type: "text", width: '50%'},
|
||||
{name: 'Price', type: 'number'}
|
||||
],
|
||||
controller: {
|
||||
loadData: function(filter) {
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
url: "data/Item/readAll",
|
||||
data: {request: JSON.stringify({showDeleted: true, filter: filter})},
|
||||
dataType: 'json'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
3
public/admin/prices.styl
Normal file
3
public/admin/prices.styl
Normal file
@@ -0,0 +1,3 @@
|
||||
#prices {
|
||||
|
||||
}
|
||||
@@ -35,8 +35,8 @@
|
||||
<div class="input-group date">
|
||||
<input name="date" id="DFDate" type="text" class="form-control" tabindex="0" placeholder="" required>
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
</div>
|
||||
<label for="DFItem">Item</label>
|
||||
<div class="form-group">
|
||||
@@ -111,7 +111,8 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
var dataTable = new LinkedTable($page.find('#dataTable'), {
|
||||
var $table = $page.find('#dataTable');
|
||||
$table.buildTable({
|
||||
url: "data/Sale/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
@@ -156,15 +157,14 @@ $(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
var dataTable = $table.getTable();
|
||||
|
||||
$page.find('#dataTable').on('dblclick', 'tr', function(event) {
|
||||
if(dataTable.getSelectedRow()) {
|
||||
location.hash = "#!/sales-edit";
|
||||
}
|
||||
});
|
||||
|
||||
//Call the refresh user table function once initially.
|
||||
dataTable.build();
|
||||
|
||||
//Refresh the data table if the user toggles the button to show/hide deleted elements.
|
||||
$page.find('#includeDeletedToggle').on('click', function(event) {
|
||||
dataTable.refresh();
|
||||
@@ -187,9 +187,9 @@ $(function() {
|
||||
//Update the dialog drop downs when the queries finish.
|
||||
$.when.apply($, queries).then(function(query1, query2, query3) {
|
||||
//Initialize the drop down menus.
|
||||
$editorForm.find("#DFItem").buildEditableSelect(query1[0], {textAttr: 'name', listClass: 'comboList'});
|
||||
$editorForm.find("#DFMeasure").buildEditableSelect(query2[0], {textAttr: 'name', listClass: 'comboList'});
|
||||
$editorForm.find("#DFVenue").buildEditableSelect(query3[0], {textAttr: 'name', listClass: 'comboList'});
|
||||
$editorForm.find("#DFItem").buildCombo(query1[0], {textAttr: 'name', listClass: 'comboList'});
|
||||
$editorForm.find("#DFMeasure").buildCombo(query2[0], {textAttr: 'name', listClass: 'comboList'});
|
||||
$editorForm.find("#DFVenue").buildCombo(query3[0], {textAttr: 'name', listClass: 'comboList'});
|
||||
//Initialize the validator
|
||||
$editorForm.validator();
|
||||
});
|
||||
@@ -287,6 +287,21 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
//Close the view if the user uses the escape key and it isn't handled at the widget level.
|
||||
$editorView.on('keyup', function(event) {
|
||||
switch(event.keyCode) {
|
||||
case 27:
|
||||
if(!event.isDefaultPrevented())
|
||||
history.back();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
$page.find('div.date').datetimepicker({
|
||||
viewMode: 'years',
|
||||
format: 'MM/DD/YY'
|
||||
});
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++ Delete View +++++++++++
|
||||
|
||||
|
||||
@@ -104,7 +104,8 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
var dataTable = new LinkedTable($page.find('#dataTable'), {
|
||||
var $table = $page.find('#dataTable');
|
||||
$table.buildTable({
|
||||
url: "data/Subcategory/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
@@ -148,15 +149,14 @@ $(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
var dataTable = $table.getTable();
|
||||
|
||||
$page.find('#dataTable').on('dblclick', 'tr', function(event) {
|
||||
if(dataTable.getSelectedRow()) {
|
||||
location.hash = "#!/subcategories-edit";
|
||||
}
|
||||
});
|
||||
|
||||
//Call the refresh user table function once initially.
|
||||
dataTable.build();
|
||||
|
||||
//Refresh the data table if the user toggles the button to show/hide deleted elements.
|
||||
$page.find('#includeDeletedToggle').on('click', function(event) {
|
||||
dataTable.refresh();
|
||||
@@ -188,7 +188,7 @@ $(function() {
|
||||
//Update the dialog drop downs when the queries finish.
|
||||
$.when.apply($, queries).then(function(query1) {
|
||||
//Initialize the drop down menu.
|
||||
$editorForm.find("#DFCategory").buildEditableSelect(query1, {textAttr: 'name', listClass: 'comboList'});
|
||||
$editorForm.find("#DFCategory").buildCombo(query1, {textAttr: 'name', listClass: 'comboList'});
|
||||
//Initialize the validator
|
||||
$editorForm.validator();
|
||||
});
|
||||
@@ -266,6 +266,16 @@ $(function() {
|
||||
});
|
||||
});
|
||||
|
||||
//Close the view if the user uses the escape key and it isn't handled at the widget level.
|
||||
$editorView.on('keyup', function(event) {
|
||||
switch(event.keyCode) {
|
||||
case 27:
|
||||
if(!event.isDefaultPrevented())
|
||||
history.back();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++
|
||||
// ++++++++++ Delete View +++++++++++
|
||||
|
||||
|
||||
@@ -143,15 +143,14 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
var dataTable = new LinkedTable($page.find('#dataTable'), {
|
||||
var $table = $page.find('#dataTable');
|
||||
$table.buildTable({
|
||||
url: "data/User/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
selectionChanged: selectionChanged
|
||||
});
|
||||
|
||||
//Call the refresh user table function once initially.
|
||||
dataTable.build();
|
||||
var dataTable = $table.getTable();
|
||||
|
||||
//----------------------------
|
||||
//---- Create User Dialog ----
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
<link rel="shortcut icon" href="images/Chicken.ico"/>
|
||||
<link rel="stylesheet" href="main.css" type="text/css"/>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-1.11.1.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-migrate-1.2.1.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-1.12.4.min.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery-migrate-1.3.0.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.history.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/layout.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="js/jquery.cycle.min.js"></script>
|
||||
|
||||
11008
public/js/jquery-1.12.4.js
vendored
Normal file
11008
public/js/jquery-1.12.4.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
public/js/jquery-1.12.4.min.js
vendored
Normal file
5
public/js/jquery-1.12.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
702
public/js/jquery-migrate-1.3.0.js
Normal file
702
public/js/jquery-migrate-1.3.0.js
Normal file
@@ -0,0 +1,702 @@
|
||||
/*!
|
||||
* jQuery Migrate - v1.3.0 - 2016-01-13
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
*/
|
||||
(function( jQuery, window, undefined ) {
|
||||
// See http://bugs.jquery.com/ticket/13335
|
||||
// "use strict";
|
||||
|
||||
|
||||
jQuery.migrateVersion = "1.3.0";
|
||||
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to true to prevent console output; migrateWarnings still maintained
|
||||
// jQuery.migrateMute = false;
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
if ( !jQuery.migrateMute && window.console && window.console.log ) {
|
||||
window.console.log("JQMIGRATE: Logging is active");
|
||||
}
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
if ( Object.defineProperty ) {
|
||||
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
|
||||
// allow property to be overwritten in case some other plugin wants it
|
||||
try {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
},
|
||||
set: function( newValue ) {
|
||||
migrateWarn( msg );
|
||||
value = newValue;
|
||||
}
|
||||
});
|
||||
return;
|
||||
} catch( err ) {
|
||||
// IE8 is a dope about Object.defineProperty, can't warn there
|
||||
}
|
||||
}
|
||||
|
||||
// Non-ES5 (or broken) browser; just set the property
|
||||
jQuery._definePropertyBroken = true;
|
||||
obj[ prop ] = value;
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
// jQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
|
||||
oldAttr = jQuery.attr,
|
||||
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
|
||||
function() { return null; },
|
||||
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
|
||||
function() { return undefined; },
|
||||
rnoType = /^(?:input|button)$/i,
|
||||
rnoAttrNodeType = /^[238]$/,
|
||||
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
||||
ruseDefault = /^(?:checked|selected)$/i;
|
||||
|
||||
// jQuery.attrFn
|
||||
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
|
||||
|
||||
jQuery.attr = function( elem, name, value, pass ) {
|
||||
var lowerName = name.toLowerCase(),
|
||||
nType = elem && elem.nodeType;
|
||||
|
||||
if ( pass ) {
|
||||
// Since pass is used internally, we only warn for new jQuery
|
||||
// versions where there isn't a pass arg in the formal params
|
||||
if ( oldAttr.length < 4 ) {
|
||||
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
|
||||
}
|
||||
if ( elem && !rnoAttrNodeType.test( nType ) &&
|
||||
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
|
||||
return jQuery( elem )[ name ]( value );
|
||||
}
|
||||
}
|
||||
|
||||
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
|
||||
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
|
||||
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
|
||||
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
|
||||
}
|
||||
|
||||
// Restore boolHook for boolean property/attribute synchronization
|
||||
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
|
||||
jQuery.attrHooks[ lowerName ] = {
|
||||
get: function( elem, name ) {
|
||||
// Align boolean attributes with corresponding properties
|
||||
// Fall back to attribute presence where some booleans are not supported
|
||||
var attrNode,
|
||||
property = jQuery.prop( elem, name );
|
||||
return property === true || typeof property !== "boolean" &&
|
||||
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
||||
|
||||
name.toLowerCase() :
|
||||
undefined;
|
||||
},
|
||||
set: function( elem, value, name ) {
|
||||
var propName;
|
||||
if ( value === false ) {
|
||||
// Remove boolean attributes when set to false
|
||||
jQuery.removeAttr( elem, name );
|
||||
} else {
|
||||
// value is true since we know at this point it's type boolean and not false
|
||||
// Set boolean attributes to the same name and set the DOM property
|
||||
propName = jQuery.propFix[ name ] || name;
|
||||
if ( propName in elem ) {
|
||||
// Only set the IDL specifically if it already exists on the element
|
||||
elem[ propName ] = true;
|
||||
}
|
||||
|
||||
elem.setAttribute( name, name.toLowerCase() );
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
// Warn only for attributes that can remain distinct from their properties post-1.9
|
||||
if ( ruseDefault.test( lowerName ) ) {
|
||||
migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldAttr.call( jQuery, elem, name, value );
|
||||
};
|
||||
|
||||
// attrHooks: value
|
||||
jQuery.attrHooks.value = {
|
||||
get: function( elem, name ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrGet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
|
||||
}
|
||||
return name in elem ?
|
||||
elem.value :
|
||||
null;
|
||||
},
|
||||
set: function( elem, value ) {
|
||||
var nodeName = ( elem.nodeName || "" ).toLowerCase();
|
||||
if ( nodeName === "button" ) {
|
||||
return valueAttrSet.apply( this, arguments );
|
||||
}
|
||||
if ( nodeName !== "input" && nodeName !== "option" ) {
|
||||
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
|
||||
}
|
||||
// Does not return so that setAttribute is also used
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var matched, browser,
|
||||
oldInit = jQuery.fn.init,
|
||||
oldParseJSON = jQuery.parseJSON,
|
||||
rspaceAngle = /^\s*</,
|
||||
// Note: XSS check is done below after string is trimmed
|
||||
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
|
||||
|
||||
// $(html) "looks like html" rule change
|
||||
jQuery.fn.init = function( selector, context, rootjQuery ) {
|
||||
var match, ret;
|
||||
|
||||
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
|
||||
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
|
||||
// This is an HTML string according to the "old" rules; is it still?
|
||||
if ( !rspaceAngle.test( selector ) ) {
|
||||
migrateWarn("$(html) HTML strings must start with '<' character");
|
||||
}
|
||||
if ( match[ 3 ] ) {
|
||||
migrateWarn("$(html) HTML text after last tag is ignored");
|
||||
}
|
||||
|
||||
// Consistently reject any HTML-like string starting with a hash (#9521)
|
||||
// Note that this may break jQuery 1.6.x code that otherwise would work.
|
||||
if ( match[ 0 ].charAt( 0 ) === "#" ) {
|
||||
migrateWarn("HTML string cannot start with a '#' character");
|
||||
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
|
||||
}
|
||||
// Now process using loose rules; let pre-1.8 play too
|
||||
if ( context && context.context ) {
|
||||
// jQuery object as context; parseHTML expects a DOM object
|
||||
context = context.context;
|
||||
}
|
||||
if ( jQuery.parseHTML ) {
|
||||
return oldInit.call( this,
|
||||
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
|
||||
context || document, true ), context, rootjQuery );
|
||||
}
|
||||
}
|
||||
|
||||
// jQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
|
||||
if ( selector === "#" ) {
|
||||
migrateWarn( "jQuery( '#' ) is not a valid selector" );
|
||||
selector = [];
|
||||
}
|
||||
|
||||
ret = oldInit.apply( this, arguments );
|
||||
|
||||
// Fill in selector and context properties so .live() works
|
||||
if ( selector && selector.selector !== undefined ) {
|
||||
// A jQuery object, copy its properties
|
||||
ret.selector = selector.selector;
|
||||
ret.context = selector.context;
|
||||
|
||||
} else {
|
||||
ret.selector = typeof selector === "string" ? selector : "";
|
||||
if ( selector ) {
|
||||
ret.context = selector.nodeType? selector : context || document;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
// Let $.parseJSON(falsy_value) return null
|
||||
jQuery.parseJSON = function( json ) {
|
||||
if ( !json ) {
|
||||
migrateWarn("jQuery.parseJSON requires a valid JSON string");
|
||||
return null;
|
||||
}
|
||||
return oldParseJSON.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
// Don't clobber any existing jQuery.browser in case it's different
|
||||
if ( !jQuery.browser ) {
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
}
|
||||
|
||||
// Warn if the code tries to get jQuery.browser
|
||||
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
|
||||
|
||||
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
|
||||
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
|
||||
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
|
||||
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
|
||||
|
||||
jQuery.sub = function() {
|
||||
function jQuerySub( selector, context ) {
|
||||
return new jQuerySub.fn.init( selector, context );
|
||||
}
|
||||
jQuery.extend( true, jQuerySub, this );
|
||||
jQuerySub.superclass = this;
|
||||
jQuerySub.fn = jQuerySub.prototype = this();
|
||||
jQuerySub.fn.constructor = jQuerySub;
|
||||
jQuerySub.sub = this.sub;
|
||||
jQuerySub.fn.init = function init( selector, context ) {
|
||||
var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||||
return instance instanceof jQuerySub ?
|
||||
instance :
|
||||
jQuerySub( instance );
|
||||
};
|
||||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||||
var rootjQuerySub = jQuerySub(document);
|
||||
migrateWarn( "jQuery.sub() is deprecated" );
|
||||
return jQuerySub;
|
||||
};
|
||||
|
||||
// The number of elements contained in the matched element set
|
||||
jQuery.fn.size = function() {
|
||||
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
|
||||
return this.length;
|
||||
};
|
||||
|
||||
|
||||
var internalSwapCall = false;
|
||||
|
||||
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
||||
if ( jQuery.swap ) {
|
||||
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
||||
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
||||
|
||||
if ( oldHook ) {
|
||||
jQuery.cssHooks[ name ].get = function() {
|
||||
var ret;
|
||||
|
||||
internalSwapCall = true;
|
||||
ret = oldHook.apply( this, arguments );
|
||||
internalSwapCall = false;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery.swap = function( elem, options, callback, args ) {
|
||||
var ret, name,
|
||||
old = {};
|
||||
|
||||
if ( !internalSwapCall ) {
|
||||
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Remember the old values, and insert the new ones
|
||||
for ( name in options ) {
|
||||
old[ name ] = elem.style[ name ];
|
||||
elem.style[ name ] = options[ name ];
|
||||
}
|
||||
|
||||
ret = callback.apply( elem, args || [] );
|
||||
|
||||
// Revert the old values
|
||||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
// Ensure that $.ajax gets the new parseJSON defined in core.js
|
||||
jQuery.ajaxSetup({
|
||||
converters: {
|
||||
"text json": jQuery.parseJSON
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var oldFnData = jQuery.fn.data;
|
||||
|
||||
jQuery.fn.data = function( name ) {
|
||||
var ret, evt,
|
||||
elem = this[0];
|
||||
|
||||
// Handles 1.7 which has this behavior and 1.8 which doesn't
|
||||
if ( elem && name === "events" && arguments.length === 1 ) {
|
||||
ret = jQuery.data( elem, name );
|
||||
evt = jQuery._data( elem, name );
|
||||
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
|
||||
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
|
||||
return evt;
|
||||
}
|
||||
}
|
||||
return oldFnData.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var rscriptType = /\/(java|ecma)script/i;
|
||||
|
||||
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
|
||||
if ( !jQuery.clean ) {
|
||||
jQuery.clean = function( elems, context, fragment, scripts ) {
|
||||
// Set context per 1.8 logic
|
||||
context = context || document;
|
||||
context = !context.nodeType && context[0] || context;
|
||||
context = context.ownerDocument || context;
|
||||
|
||||
migrateWarn("jQuery.clean() is deprecated");
|
||||
|
||||
var i, elem, handleScript, jsTags,
|
||||
ret = [];
|
||||
|
||||
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
|
||||
|
||||
// Complex logic lifted directly from jQuery 1.8
|
||||
if ( fragment ) {
|
||||
// Special handling of each script element
|
||||
handleScript = function( elem ) {
|
||||
// Check if we consider it executable
|
||||
if ( !elem.type || rscriptType.test( elem.type ) ) {
|
||||
// Detach the script and store it in the scripts array (if provided) or the fragment
|
||||
// Return truthy to indicate that it has been handled
|
||||
return scripts ?
|
||||
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
|
||||
fragment.appendChild( elem );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; (elem = ret[i]) != null; i++ ) {
|
||||
// Check if we're done after handling an executable script
|
||||
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
|
||||
// Append to fragment and handle embedded scripts
|
||||
fragment.appendChild( elem );
|
||||
if ( typeof elem.getElementsByTagName !== "undefined" ) {
|
||||
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
|
||||
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
|
||||
|
||||
// Splice the scripts into ret after their former ancestor and advance our index beyond them
|
||||
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
|
||||
i += jsTags.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
var eventAdd = jQuery.event.add,
|
||||
eventRemove = jQuery.event.remove,
|
||||
eventTrigger = jQuery.event.trigger,
|
||||
oldToggle = jQuery.fn.toggle,
|
||||
oldLive = jQuery.fn.live,
|
||||
oldDie = jQuery.fn.die,
|
||||
oldLoad = jQuery.fn.load,
|
||||
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
|
||||
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
|
||||
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
|
||||
hoverHack = function( events ) {
|
||||
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
|
||||
return events;
|
||||
}
|
||||
if ( rhoverHack.test( events ) ) {
|
||||
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
|
||||
}
|
||||
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
||||
};
|
||||
|
||||
// Event props removed in 1.9, put them back if needed; no practical way to warn them
|
||||
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
|
||||
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
|
||||
}
|
||||
|
||||
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
|
||||
if ( jQuery.event.dispatch ) {
|
||||
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Support for 'hover' pseudo-event and ajax event warnings
|
||||
jQuery.event.add = function( elem, types, handler, data, selector ){
|
||||
if ( elem !== document && rajaxEvent.test( types ) ) {
|
||||
migrateWarn( "AJAX events should be attached to document: " + types );
|
||||
}
|
||||
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
|
||||
};
|
||||
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
|
||||
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
|
||||
};
|
||||
|
||||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
||||
|
||||
jQuery.fn[ name ] = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0 );
|
||||
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
||||
|
||||
// If this is an ajax load() the first arg should be the string URL;
|
||||
// technically this could also be the "Anything" arg of the event .load()
|
||||
// which just goes to show why this dumb signature has been deprecated!
|
||||
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
||||
if ( name === "load" && typeof arguments[ 0 ] === "string" ) {
|
||||
return oldLoad.apply( this, arguments );
|
||||
}
|
||||
|
||||
args.splice( 0, 0, name );
|
||||
if ( arguments.length ) {
|
||||
return this.bind.apply( this, args );
|
||||
}
|
||||
|
||||
// Use .triggerHandler here because:
|
||||
// - load and unload events don't need to bubble, only applied to window or image
|
||||
// - error event should not bubble to window, although it does pre-1.7
|
||||
// See http://bugs.jquery.com/ticket/11820
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
jQuery.fn.toggle = function( fn, fn2 ) {
|
||||
|
||||
// Don't mess with animation or css toggles
|
||||
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
|
||||
return oldToggle.apply( this, arguments );
|
||||
}
|
||||
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
|
||||
|
||||
// Save reference to arguments for access in closure
|
||||
var args = arguments,
|
||||
guid = fn.guid || jQuery.guid++,
|
||||
i = 0,
|
||||
toggler = function( event ) {
|
||||
// Figure out which function to execute
|
||||
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
|
||||
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
|
||||
|
||||
// Make sure that clicks stop
|
||||
event.preventDefault();
|
||||
|
||||
// and execute the function
|
||||
return args[ lastToggle ].apply( this, arguments ) || false;
|
||||
};
|
||||
|
||||
// link all the functions, so any of them can unbind this click handler
|
||||
toggler.guid = guid;
|
||||
while ( i < args.length ) {
|
||||
args[ i++ ].guid = guid;
|
||||
}
|
||||
|
||||
return this.click( toggler );
|
||||
};
|
||||
|
||||
jQuery.fn.live = function( types, data, fn ) {
|
||||
migrateWarn("jQuery.fn.live() is deprecated");
|
||||
if ( oldLive ) {
|
||||
return oldLive.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).on( types, this.selector, data, fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.fn.die = function( types, fn ) {
|
||||
migrateWarn("jQuery.fn.die() is deprecated");
|
||||
if ( oldDie ) {
|
||||
return oldDie.apply( this, arguments );
|
||||
}
|
||||
jQuery( this.context ).off( types, this.selector || "**", fn );
|
||||
return this;
|
||||
};
|
||||
|
||||
// Turn global events into document-triggered events
|
||||
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
|
||||
if ( !elem && !rajaxEvent.test( event ) ) {
|
||||
migrateWarn( "Global events are undocumented and deprecated" );
|
||||
}
|
||||
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
|
||||
};
|
||||
jQuery.each( ajaxEvents.split("|"),
|
||||
function( _, name ) {
|
||||
jQuery.event.special[ name ] = {
|
||||
setup: function() {
|
||||
var elem = this;
|
||||
|
||||
// The document needs no shimming; must be !== for oldIE
|
||||
if ( elem !== document ) {
|
||||
jQuery.event.add( document, name + "." + jQuery.guid, function() {
|
||||
jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
|
||||
});
|
||||
jQuery._data( this, name, jQuery.guid++ );
|
||||
}
|
||||
return false;
|
||||
},
|
||||
teardown: function() {
|
||||
if ( this !== document ) {
|
||||
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
jQuery.event.special.ready = {
|
||||
setup: function() { migrateWarn( "'ready' event is deprecated" ); }
|
||||
};
|
||||
|
||||
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
|
||||
oldFind = jQuery.fn.find;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.fn.find = function( selector ) {
|
||||
var ret = oldFind.apply( this, arguments );
|
||||
ret.context = this.context;
|
||||
ret.selector = this.selector ? this.selector + " " + selector : selector;
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
// jQuery 1.6 did not support Callbacks, do not warn there
|
||||
if ( jQuery.Callbacks ) {
|
||||
|
||||
var oldDeferred = jQuery.Deferred,
|
||||
tuples = [
|
||||
// action, add listener, callbacks, .then handlers, final state
|
||||
[ "resolve", "done", jQuery.Callbacks("once memory"),
|
||||
jQuery.Callbacks("once memory"), "resolved" ],
|
||||
[ "reject", "fail", jQuery.Callbacks("once memory"),
|
||||
jQuery.Callbacks("once memory"), "rejected" ],
|
||||
[ "notify", "progress", jQuery.Callbacks("memory"),
|
||||
jQuery.Callbacks("memory") ]
|
||||
];
|
||||
|
||||
jQuery.Deferred = function( func ) {
|
||||
var deferred = oldDeferred(),
|
||||
promise = deferred.promise();
|
||||
|
||||
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
||||
var fns = arguments;
|
||||
|
||||
migrateWarn( "deferred.pipe() is deprecated" );
|
||||
|
||||
return jQuery.Deferred(function( newDefer ) {
|
||||
jQuery.each( tuples, function( i, tuple ) {
|
||||
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
||||
// deferred.done(function() { bind to newDefer or newDefer.resolve })
|
||||
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
||||
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
||||
deferred[ tuple[1] ](function() {
|
||||
var returned = fn && fn.apply( this, arguments );
|
||||
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
||||
returned.promise()
|
||||
.done( newDefer.resolve )
|
||||
.fail( newDefer.reject )
|
||||
.progress( newDefer.notify );
|
||||
} else {
|
||||
newDefer[ tuple[ 0 ] + "With" ](
|
||||
this === promise ? newDefer.promise() : this,
|
||||
fn ? [ returned ] : arguments
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
fns = null;
|
||||
}).promise();
|
||||
|
||||
};
|
||||
|
||||
deferred.isResolved = function() {
|
||||
migrateWarn( "deferred.isResolved is deprecated" );
|
||||
return deferred.state() === "resolved";
|
||||
};
|
||||
|
||||
deferred.isRejected = function() {
|
||||
migrateWarn( "deferred.isRejected is deprecated" );
|
||||
return deferred.state() === "rejected";
|
||||
};
|
||||
|
||||
if ( func ) {
|
||||
func.call( deferred, deferred );
|
||||
}
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
})( jQuery, window );
|
||||
2
public/js/jquery-migrate-1.3.0.min.js
vendored
Normal file
2
public/js/jquery-migrate-1.3.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
540
public/js/jquery-migrate-3.0.0.js
Normal file
540
public/js/jquery-migrate-3.0.0.js
Normal file
@@ -0,0 +1,540 @@
|
||||
/*!
|
||||
* jQuery Migrate - v3.0.0 - 2016-06-09
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
*/
|
||||
(function( jQuery, window ) {
|
||||
"use strict";
|
||||
|
||||
|
||||
jQuery.migrateVersion = "3.0.0";
|
||||
|
||||
|
||||
( function() {
|
||||
|
||||
// Support: IE9 only
|
||||
// IE9 only creates console object when dev tools are first opened
|
||||
// Also, avoid Function#bind here to simplify PhantomJS usage
|
||||
var log = window.console && window.console.log &&
|
||||
function() { window.console.log.apply( window.console, arguments ); },
|
||||
rbadVersions = /^[12]\./;
|
||||
|
||||
if ( !log ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Need jQuery 3.0.0+ and no older Migrate loaded
|
||||
if ( !jQuery || rbadVersions.test( jQuery.fn.jquery ) ) {
|
||||
log( "JQMIGRATE: jQuery 3.0.0+ REQUIRED" );
|
||||
}
|
||||
if ( jQuery.migrateWarnings ) {
|
||||
log( "JQMIGRATE: Migrate plugin loaded multiple times" );
|
||||
}
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
log( "JQMIGRATE: Migrate is installed" +
|
||||
( jQuery.migrateMute ? "" : " with logging active" ) +
|
||||
", version " + jQuery.migrateVersion );
|
||||
|
||||
} )();
|
||||
|
||||
var warnedAbout = {};
|
||||
|
||||
// List of warnings already given; public read only
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
jQuery.migrateReset = function() {
|
||||
warnedAbout = {};
|
||||
jQuery.migrateWarnings.length = 0;
|
||||
};
|
||||
|
||||
function migrateWarn( msg ) {
|
||||
var console = window.console;
|
||||
if ( !warnedAbout[ msg ] ) {
|
||||
warnedAbout[ msg ] = true;
|
||||
jQuery.migrateWarnings.push( msg );
|
||||
if ( console && console.warn && !jQuery.migrateMute ) {
|
||||
console.warn( "JQMIGRATE: " + msg );
|
||||
if ( jQuery.migrateTrace && console.trace ) {
|
||||
console.trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrateWarnProp( obj, prop, value, msg ) {
|
||||
Object.defineProperty( obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
migrateWarn( msg );
|
||||
return value;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( document.compatMode === "BackCompat" ) {
|
||||
|
||||
// JQuery has never supported or tested Quirks Mode
|
||||
migrateWarn( "jQuery is not compatible with Quirks Mode" );
|
||||
}
|
||||
|
||||
|
||||
var oldInit = jQuery.fn.init,
|
||||
oldIsNumeric = jQuery.isNumeric,
|
||||
oldFind = jQuery.find,
|
||||
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
|
||||
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g;
|
||||
|
||||
jQuery.fn.init = function( arg1 ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
if ( typeof arg1 === "string" && arg1 === "#" ) {
|
||||
|
||||
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set before jQuery 3.0
|
||||
migrateWarn( "jQuery( '#' ) is not a valid selector" );
|
||||
args[ 0 ] = [];
|
||||
}
|
||||
|
||||
return oldInit.apply( this, args );
|
||||
};
|
||||
jQuery.fn.init.prototype = jQuery.fn;
|
||||
|
||||
jQuery.find = function( selector ) {
|
||||
var args = Array.prototype.slice.call( arguments );
|
||||
|
||||
// Support: PhantomJS 1.x
|
||||
// String#match fails to match when used with a //g RegExp, only on some strings
|
||||
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
|
||||
|
||||
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
|
||||
// First see if qS thinks it's a valid selector, if so avoid a false positive
|
||||
try {
|
||||
document.querySelector( selector );
|
||||
} catch ( err1 ) {
|
||||
|
||||
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
|
||||
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
|
||||
return "[" + attr + op + "\"" + value + "\"]";
|
||||
} );
|
||||
|
||||
// If the regexp *may* have created an invalid selector, don't update it
|
||||
// Note that there may be false alarms if selector uses jQuery extensions
|
||||
try {
|
||||
document.querySelector( selector );
|
||||
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
|
||||
args[ 0 ] = selector;
|
||||
} catch ( err2 ) {
|
||||
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oldFind.apply( this, args );
|
||||
};
|
||||
|
||||
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
|
||||
var findProp;
|
||||
for ( findProp in oldFind ) {
|
||||
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
|
||||
jQuery.find[ findProp ] = oldFind[ findProp ];
|
||||
}
|
||||
}
|
||||
|
||||
// The number of elements contained in the matched element set
|
||||
jQuery.fn.size = function() {
|
||||
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
|
||||
return this.length;
|
||||
};
|
||||
|
||||
jQuery.parseJSON = function() {
|
||||
migrateWarn( "jQuery.parseJSON is deprecated; use JSON.parse" );
|
||||
return JSON.parse.apply( null, arguments );
|
||||
};
|
||||
|
||||
jQuery.isNumeric = function( val ) {
|
||||
|
||||
// The jQuery 2.2.3 implementation of isNumeric
|
||||
function isNumeric2( obj ) {
|
||||
var realStringObj = obj && obj.toString();
|
||||
return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
|
||||
}
|
||||
|
||||
var newValue = oldIsNumeric( val ),
|
||||
oldValue = isNumeric2( val );
|
||||
|
||||
if ( newValue !== oldValue ) {
|
||||
migrateWarn( "jQuery.isNumeric() should not be called on constructed objects" );
|
||||
}
|
||||
|
||||
return oldValue;
|
||||
};
|
||||
|
||||
migrateWarnProp( jQuery, "unique", jQuery.uniqueSort,
|
||||
"jQuery.unique is deprecated, use jQuery.uniqueSort" );
|
||||
|
||||
// Now jQuery.expr.pseudos is the standard incantation
|
||||
migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos,
|
||||
"jQuery.expr.filters is now jQuery.expr.pseudos" );
|
||||
migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos,
|
||||
"jQuery.expr[\":\"] is now jQuery.expr.pseudos" );
|
||||
|
||||
|
||||
var oldAjax = jQuery.ajax;
|
||||
|
||||
jQuery.ajax = function( ) {
|
||||
var jQXHR = oldAjax.apply( this, arguments );
|
||||
|
||||
// Be sure we got a jQXHR (e.g., not sync)
|
||||
if ( jQXHR.promise ) {
|
||||
migrateWarnProp( jQXHR, "success", jQXHR.done,
|
||||
"jQXHR.success is deprecated and removed" );
|
||||
migrateWarnProp( jQXHR, "error", jQXHR.fail,
|
||||
"jQXHR.error is deprecated and removed" );
|
||||
migrateWarnProp( jQXHR, "complete", jQXHR.always,
|
||||
"jQXHR.complete is deprecated and removed" );
|
||||
}
|
||||
|
||||
return jQXHR;
|
||||
};
|
||||
|
||||
|
||||
var oldRemoveAttr = jQuery.fn.removeAttr,
|
||||
oldToggleClass = jQuery.fn.toggleClass,
|
||||
rmatchNonSpace = /\S+/g;
|
||||
|
||||
jQuery.fn.removeAttr = function( name ) {
|
||||
var self = this;
|
||||
|
||||
jQuery.each( name.match( rmatchNonSpace ), function( i, attr ) {
|
||||
if ( jQuery.expr.match.bool.test( attr ) ) {
|
||||
migrateWarn( "jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
|
||||
self.prop( attr, false );
|
||||
}
|
||||
} );
|
||||
|
||||
return oldRemoveAttr.apply( this, arguments );
|
||||
};
|
||||
|
||||
jQuery.fn.toggleClass = function( state ) {
|
||||
|
||||
// Only deprecating no-args or single boolean arg
|
||||
if ( state !== undefined && typeof state !== "boolean" ) {
|
||||
return oldToggleClass.apply( this, arguments );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn.toggleClass( boolean ) is deprecated" );
|
||||
|
||||
// Toggle entire class name of each element
|
||||
return this.each( function() {
|
||||
var className = this.getAttribute && this.getAttribute( "class" ) || "";
|
||||
|
||||
if ( className ) {
|
||||
jQuery.data( this, "__className__", className );
|
||||
}
|
||||
|
||||
// If the element has a class name or if we're passed `false`,
|
||||
// then remove the whole classname (if there was one, the above saved it).
|
||||
// Otherwise bring back whatever was previously saved (if anything),
|
||||
// falling back to the empty string if nothing was stored.
|
||||
if ( this.setAttribute ) {
|
||||
this.setAttribute( "class",
|
||||
className || state === false ?
|
||||
"" :
|
||||
jQuery.data( this, "__className__" ) || ""
|
||||
);
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
|
||||
var internalSwapCall = false;
|
||||
|
||||
// If this version of jQuery has .swap(), don't false-alarm on internal uses
|
||||
if ( jQuery.swap ) {
|
||||
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
|
||||
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
|
||||
|
||||
if ( oldHook ) {
|
||||
jQuery.cssHooks[ name ].get = function() {
|
||||
var ret;
|
||||
|
||||
internalSwapCall = true;
|
||||
ret = oldHook.apply( this, arguments );
|
||||
internalSwapCall = false;
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
jQuery.swap = function( elem, options, callback, args ) {
|
||||
var ret, name,
|
||||
old = {};
|
||||
|
||||
if ( !internalSwapCall ) {
|
||||
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
|
||||
}
|
||||
|
||||
// Remember the old values, and insert the new ones
|
||||
for ( name in options ) {
|
||||
old[ name ] = elem.style[ name ];
|
||||
elem.style[ name ] = options[ name ];
|
||||
}
|
||||
|
||||
ret = callback.apply( elem, args || [] );
|
||||
|
||||
// Revert the old values
|
||||
for ( name in options ) {
|
||||
elem.style[ name ] = old[ name ];
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
var oldData = jQuery.data;
|
||||
|
||||
jQuery.data = function( elem, name, value ) {
|
||||
var curData;
|
||||
|
||||
// If the name is transformed, look for the un-transformed name in the data object
|
||||
if ( name && name !== jQuery.camelCase( name ) ) {
|
||||
curData = jQuery.hasData( elem ) && oldData.call( this, elem );
|
||||
if ( curData && name in curData ) {
|
||||
migrateWarn( "jQuery.data() always sets/gets camelCased names: " + name );
|
||||
if ( arguments.length > 2 ) {
|
||||
curData[ name ] = value;
|
||||
}
|
||||
return curData[ name ];
|
||||
}
|
||||
}
|
||||
|
||||
return oldData.apply( this, arguments );
|
||||
};
|
||||
|
||||
var oldTweenRun = jQuery.Tween.prototype.run;
|
||||
|
||||
jQuery.Tween.prototype.run = function( percent ) {
|
||||
if ( jQuery.easing[ this.easing ].length > 1 ) {
|
||||
migrateWarn(
|
||||
"easing function " +
|
||||
"\"jQuery.easing." + this.easing.toString() +
|
||||
"\" should use only first argument"
|
||||
);
|
||||
|
||||
jQuery.easing[ this.easing ] = jQuery.easing[ this.easing ].bind(
|
||||
jQuery.easing,
|
||||
percent, this.options.duration * percent, 0, 1, this.options.duration
|
||||
);
|
||||
}
|
||||
|
||||
oldTweenRun.apply( this, arguments );
|
||||
};
|
||||
|
||||
var oldLoad = jQuery.fn.load,
|
||||
originalFix = jQuery.event.fix;
|
||||
|
||||
jQuery.event.props = [];
|
||||
jQuery.event.fixHooks = {};
|
||||
|
||||
jQuery.event.fix = function( originalEvent ) {
|
||||
var event,
|
||||
type = originalEvent.type,
|
||||
fixHook = this.fixHooks[ type ],
|
||||
props = jQuery.event.props;
|
||||
|
||||
if ( props.length ) {
|
||||
migrateWarn( "jQuery.event.props are deprecated and removed: " + props.join() );
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( fixHook && !fixHook._migrated_ ) {
|
||||
fixHook._migrated_ = true;
|
||||
migrateWarn( "jQuery.event.fixHooks are deprecated and removed: " + type );
|
||||
if ( ( props = fixHook.props ) && props.length ) {
|
||||
while ( props.length ) {
|
||||
jQuery.event.addProp( props.pop() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event = originalFix.call( this, originalEvent );
|
||||
|
||||
return fixHook && fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
||||
};
|
||||
|
||||
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
|
||||
|
||||
jQuery.fn[ name ] = function() {
|
||||
var args = Array.prototype.slice.call( arguments, 0 );
|
||||
|
||||
// If this is an ajax load() the first arg should be the string URL;
|
||||
// technically this could also be the "Anything" arg of the event .load()
|
||||
// which just goes to show why this dumb signature has been deprecated!
|
||||
// jQuery custom builds that exclude the Ajax module justifiably die here.
|
||||
if ( name === "load" && typeof args[ 0 ] === "string" ) {
|
||||
return oldLoad.apply( this, args );
|
||||
}
|
||||
|
||||
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
|
||||
|
||||
args.splice( 0, 0, name );
|
||||
if ( arguments.length ) {
|
||||
return this.on.apply( this, args );
|
||||
}
|
||||
|
||||
// Use .triggerHandler here because:
|
||||
// - load and unload events don't need to bubble, only applied to window or image
|
||||
// - error event should not bubble to window, although it does pre-1.7
|
||||
// See http://bugs.jquery.com/ticket/11820
|
||||
this.triggerHandler.apply( this, args );
|
||||
return this;
|
||||
};
|
||||
|
||||
} );
|
||||
|
||||
// Trigger "ready" event only once, on document ready
|
||||
jQuery( function() {
|
||||
jQuery( document ).triggerHandler( "ready" );
|
||||
} );
|
||||
|
||||
jQuery.event.special.ready = {
|
||||
setup: function() {
|
||||
if ( this === document ) {
|
||||
migrateWarn( "'ready' event is deprecated" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.fn.extend( {
|
||||
|
||||
bind: function( types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.bind() is deprecated" );
|
||||
return this.on( types, null, data, fn );
|
||||
},
|
||||
unbind: function( types, fn ) {
|
||||
migrateWarn( "jQuery.fn.unbind() is deprecated" );
|
||||
return this.off( types, null, fn );
|
||||
},
|
||||
delegate: function( selector, types, data, fn ) {
|
||||
migrateWarn( "jQuery.fn.delegate() is deprecated" );
|
||||
return this.on( types, selector, data, fn );
|
||||
},
|
||||
undelegate: function( selector, types, fn ) {
|
||||
migrateWarn( "jQuery.fn.undelegate() is deprecated" );
|
||||
return arguments.length === 1 ?
|
||||
this.off( selector, "**" ) :
|
||||
this.off( types, selector || "**", fn );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
var oldOffset = jQuery.fn.offset;
|
||||
|
||||
jQuery.fn.offset = function() {
|
||||
var docElem,
|
||||
elem = this[ 0 ],
|
||||
origin = { top: 0, left: 0 };
|
||||
|
||||
if ( !elem || !elem.nodeType ) {
|
||||
migrateWarn( "jQuery.fn.offset() requires a valid DOM element" );
|
||||
return origin;
|
||||
}
|
||||
|
||||
docElem = ( elem.ownerDocument || document ).documentElement;
|
||||
if ( !jQuery.contains( docElem, elem ) ) {
|
||||
migrateWarn( "jQuery.fn.offset() requires an element connected to a document" );
|
||||
return origin;
|
||||
}
|
||||
|
||||
return oldOffset.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var oldParam = jQuery.param;
|
||||
|
||||
jQuery.param = function( data, traditional ) {
|
||||
var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
|
||||
|
||||
if ( traditional === undefined && ajaxTraditional ) {
|
||||
|
||||
migrateWarn( "jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
|
||||
traditional = ajaxTraditional;
|
||||
}
|
||||
|
||||
return oldParam.call( this, data, traditional );
|
||||
};
|
||||
|
||||
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
|
||||
|
||||
jQuery.fn.andSelf = function() {
|
||||
migrateWarn( "jQuery.fn.andSelf() replaced by jQuery.fn.addBack()" );
|
||||
return oldSelf.apply( this, arguments );
|
||||
};
|
||||
|
||||
|
||||
var oldDeferred = jQuery.Deferred,
|
||||
tuples = [
|
||||
|
||||
// Action, add listener, callbacks, .then handlers, final state
|
||||
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "resolved" ],
|
||||
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
|
||||
jQuery.Callbacks( "once memory" ), "rejected" ],
|
||||
[ "notify", "progress", jQuery.Callbacks( "memory" ),
|
||||
jQuery.Callbacks( "memory" ) ]
|
||||
];
|
||||
|
||||
jQuery.Deferred = function( func ) {
|
||||
var deferred = oldDeferred(),
|
||||
promise = deferred.promise();
|
||||
|
||||
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
|
||||
var fns = arguments;
|
||||
|
||||
migrateWarn( "deferred.pipe() is deprecated" );
|
||||
|
||||
return jQuery.Deferred( function( newDefer ) {
|
||||
jQuery.each( tuples, function( i, tuple ) {
|
||||
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
|
||||
|
||||
// Deferred.done(function() { bind to newDefer or newDefer.resolve })
|
||||
// deferred.fail(function() { bind to newDefer or newDefer.reject })
|
||||
// deferred.progress(function() { bind to newDefer or newDefer.notify })
|
||||
deferred[ tuple[ 1 ] ]( function() {
|
||||
var returned = fn && fn.apply( this, arguments );
|
||||
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
||||
returned.promise()
|
||||
.done( newDefer.resolve )
|
||||
.fail( newDefer.reject )
|
||||
.progress( newDefer.notify );
|
||||
} else {
|
||||
newDefer[ tuple[ 0 ] + "With" ](
|
||||
this === promise ? newDefer.promise() : this,
|
||||
fn ? [ returned ] : arguments
|
||||
);
|
||||
}
|
||||
} );
|
||||
} );
|
||||
fns = null;
|
||||
} ).promise();
|
||||
|
||||
};
|
||||
|
||||
if ( func ) {
|
||||
func.call( deferred, deferred );
|
||||
}
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
|
||||
|
||||
})( jQuery, window );
|
||||
2
public/js/jquery-migrate-3.0.0.min.js
vendored
Normal file
2
public/js/jquery-migrate-3.0.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
515
public/js/resize/ElementQueries.js
Normal file
515
public/js/resize/ElementQueries.js
Normal file
@@ -0,0 +1,515 @@
|
||||
/**
|
||||
* Copyright Marc J. Schmidt. See the LICENSE file at the top-level
|
||||
* directory of this distribution and at
|
||||
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
|
||||
*/
|
||||
;
|
||||
(function (root, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(['./ResizeSensor.js'], factory);
|
||||
} else if (typeof exports === "object") {
|
||||
module.exports = factory(require('./ResizeSensor.js'));
|
||||
} else {
|
||||
root.ElementQueries = factory(root.ResizeSensor);
|
||||
}
|
||||
}(this, function (ResizeSensor) {
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {Function}
|
||||
* @constructor
|
||||
*/
|
||||
var ElementQueries = function() {
|
||||
|
||||
var trackingActive = false;
|
||||
var elements = [];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param element
|
||||
* @returns {Number}
|
||||
*/
|
||||
function getEmSize(element) {
|
||||
if (!element) {
|
||||
element = document.documentElement;
|
||||
}
|
||||
var fontSize = window.getComputedStyle(element, null).fontSize;
|
||||
return parseFloat(fontSize) || 16;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @copyright https://github.com/Mr0grog/element-query/blob/master/LICENSE
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @param {*} value
|
||||
* @returns {*}
|
||||
*/
|
||||
function convertToPx(element, value) {
|
||||
var numbers = value.split(/\d/);
|
||||
var units = numbers[numbers.length-1];
|
||||
value = parseFloat(value);
|
||||
switch (units) {
|
||||
case "px":
|
||||
return value;
|
||||
case "em":
|
||||
return value * getEmSize(element);
|
||||
case "rem":
|
||||
return value * getEmSize();
|
||||
// Viewport units!
|
||||
// According to http://quirksmode.org/mobile/tableViewport.html
|
||||
// documentElement.clientWidth/Height gets us the most reliable info
|
||||
case "vw":
|
||||
return value * document.documentElement.clientWidth / 100;
|
||||
case "vh":
|
||||
return value * document.documentElement.clientHeight / 100;
|
||||
case "vmin":
|
||||
case "vmax":
|
||||
var vw = document.documentElement.clientWidth / 100;
|
||||
var vh = document.documentElement.clientHeight / 100;
|
||||
var chooser = Math[units === "vmin" ? "min" : "max"];
|
||||
return value * chooser(vw, vh);
|
||||
default:
|
||||
return value;
|
||||
// for now, not supporting physical units (since they are just a set number of px)
|
||||
// or ex/ch (getting accurate measurements is hard)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @constructor
|
||||
*/
|
||||
function SetupInformation(element) {
|
||||
this.element = element;
|
||||
this.options = {};
|
||||
var key, option, width = 0, height = 0, value, actualValue, attrValues, attrValue, attrName;
|
||||
|
||||
/**
|
||||
* @param {Object} option {mode: 'min|max', property: 'width|height', value: '123px'}
|
||||
*/
|
||||
this.addOption = function(option) {
|
||||
var idx = [option.mode, option.property, option.value].join(',');
|
||||
this.options[idx] = option;
|
||||
};
|
||||
|
||||
var attributes = ['min-width', 'min-height', 'max-width', 'max-height'];
|
||||
|
||||
/**
|
||||
* Extracts the computed width/height and sets to min/max- attribute.
|
||||
*/
|
||||
this.call = function() {
|
||||
// extract current dimensions
|
||||
width = this.element.offsetWidth;
|
||||
height = this.element.offsetHeight;
|
||||
|
||||
attrValues = {};
|
||||
|
||||
for (key in this.options) {
|
||||
if (!this.options.hasOwnProperty(key)){
|
||||
continue;
|
||||
}
|
||||
option = this.options[key];
|
||||
|
||||
value = convertToPx(this.element, option.value);
|
||||
|
||||
actualValue = option.property == 'width' ? width : height;
|
||||
attrName = option.mode + '-' + option.property;
|
||||
attrValue = '';
|
||||
|
||||
if (option.mode == 'min' && actualValue >= value) {
|
||||
attrValue += option.value;
|
||||
}
|
||||
|
||||
if (option.mode == 'max' && actualValue <= value) {
|
||||
attrValue += option.value;
|
||||
}
|
||||
|
||||
if (!attrValues[attrName]) attrValues[attrName] = '';
|
||||
if (attrValue && -1 === (' '+attrValues[attrName]+' ').indexOf(' ' + attrValue + ' ')) {
|
||||
attrValues[attrName] += ' ' + attrValue;
|
||||
}
|
||||
}
|
||||
|
||||
for (var k in attributes) {
|
||||
if(!attributes.hasOwnProperty(k)) continue;
|
||||
|
||||
if (attrValues[attributes[k]]) {
|
||||
this.element.setAttribute(attributes[k], attrValues[attributes[k]].substr(1));
|
||||
} else {
|
||||
this.element.removeAttribute(attributes[k]);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} element
|
||||
* @param {Object} options
|
||||
*/
|
||||
function setupElement(element, options) {
|
||||
if (element.elementQueriesSetupInformation) {
|
||||
element.elementQueriesSetupInformation.addOption(options);
|
||||
} else {
|
||||
element.elementQueriesSetupInformation = new SetupInformation(element);
|
||||
element.elementQueriesSetupInformation.addOption(options);
|
||||
element.elementQueriesSensor = new ResizeSensor(element, function() {
|
||||
element.elementQueriesSetupInformation.call();
|
||||
});
|
||||
}
|
||||
element.elementQueriesSetupInformation.call();
|
||||
|
||||
if (trackingActive && elements.indexOf(element) < 0) {
|
||||
elements.push(element);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} selector
|
||||
* @param {String} mode min|max
|
||||
* @param {String} property width|height
|
||||
* @param {String} value
|
||||
*/
|
||||
var allQueries = {};
|
||||
function queueQuery(selector, mode, property, value) {
|
||||
if (typeof(allQueries[mode]) == 'undefined') allQueries[mode] = {};
|
||||
if (typeof(allQueries[mode][property]) == 'undefined') allQueries[mode][property] = {};
|
||||
if (typeof(allQueries[mode][property][value]) == 'undefined') allQueries[mode][property][value] = selector;
|
||||
else allQueries[mode][property][value] += ','+selector;
|
||||
}
|
||||
|
||||
function getQuery() {
|
||||
var query;
|
||||
if (document.querySelectorAll) query = document.querySelectorAll.bind(document);
|
||||
if (!query && 'undefined' !== typeof $$) query = $$;
|
||||
if (!query && 'undefined' !== typeof jQuery) query = jQuery;
|
||||
|
||||
if (!query) {
|
||||
throw 'No document.querySelectorAll, jQuery or Mootools\'s $$ found.';
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the magic. Go through all collected rules (readRules()) and attach the resize-listener.
|
||||
*/
|
||||
function findElementQueriesElements() {
|
||||
var query = getQuery();
|
||||
|
||||
for (var mode in allQueries) if (allQueries.hasOwnProperty(mode)) {
|
||||
|
||||
for (var property in allQueries[mode]) if (allQueries[mode].hasOwnProperty(property)) {
|
||||
for (var value in allQueries[mode][property]) if (allQueries[mode][property].hasOwnProperty(value)) {
|
||||
var elements = query(allQueries[mode][property][value]);
|
||||
for (var i = 0, j = elements.length; i < j; i++) {
|
||||
setupElement(elements[i], {
|
||||
mode: mode,
|
||||
property: property,
|
||||
value: value
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
*/
|
||||
function attachResponsiveImage(element) {
|
||||
var children = [];
|
||||
var rules = [];
|
||||
var sources = [];
|
||||
var defaultImageId = 0;
|
||||
var lastActiveImage = -1;
|
||||
var loadedImages = [];
|
||||
|
||||
for (var i in element.children) {
|
||||
if(!element.children.hasOwnProperty(i)) continue;
|
||||
|
||||
if (element.children[i].tagName && element.children[i].tagName.toLowerCase() === 'img') {
|
||||
children.push(element.children[i]);
|
||||
|
||||
var minWidth = element.children[i].getAttribute('min-width') || element.children[i].getAttribute('data-min-width');
|
||||
//var minHeight = element.children[i].getAttribute('min-height') || element.children[i].getAttribute('data-min-height');
|
||||
var src = element.children[i].getAttribute('data-src') || element.children[i].getAttribute('url');
|
||||
|
||||
sources.push(src);
|
||||
|
||||
var rule = {
|
||||
minWidth: minWidth
|
||||
};
|
||||
|
||||
rules.push(rule);
|
||||
|
||||
if (!minWidth) {
|
||||
defaultImageId = children.length - 1;
|
||||
element.children[i].style.display = 'block';
|
||||
} else {
|
||||
element.children[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastActiveImage = defaultImageId;
|
||||
|
||||
function check() {
|
||||
var imageToDisplay = false, i;
|
||||
|
||||
for (i in children){
|
||||
if(!children.hasOwnProperty(i)) continue;
|
||||
|
||||
if (rules[i].minWidth) {
|
||||
if (element.offsetWidth > rules[i].minWidth) {
|
||||
imageToDisplay = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!imageToDisplay) {
|
||||
//no rule matched, show default
|
||||
imageToDisplay = defaultImageId;
|
||||
}
|
||||
|
||||
if (lastActiveImage != imageToDisplay) {
|
||||
//image change
|
||||
|
||||
if (!loadedImages[imageToDisplay]){
|
||||
//image has not been loaded yet, we need to load the image first in memory to prevent flash of
|
||||
//no content
|
||||
|
||||
var image = new Image();
|
||||
image.onload = function() {
|
||||
children[imageToDisplay].src = sources[imageToDisplay];
|
||||
|
||||
children[lastActiveImage].style.display = 'none';
|
||||
children[imageToDisplay].style.display = 'block';
|
||||
|
||||
loadedImages[imageToDisplay] = true;
|
||||
|
||||
lastActiveImage = imageToDisplay;
|
||||
};
|
||||
|
||||
image.src = sources[imageToDisplay];
|
||||
} else {
|
||||
children[lastActiveImage].style.display = 'none';
|
||||
children[imageToDisplay].style.display = 'block';
|
||||
lastActiveImage = imageToDisplay;
|
||||
}
|
||||
} else {
|
||||
//make sure for initial check call the .src is set correctly
|
||||
children[imageToDisplay].src = sources[imageToDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
element.resizeSensor = new ResizeSensor(element, check);
|
||||
check();
|
||||
|
||||
if (trackingActive) {
|
||||
elements.push(element);
|
||||
}
|
||||
}
|
||||
|
||||
function findResponsiveImages(){
|
||||
var query = getQuery();
|
||||
|
||||
var elements = query('[data-responsive-image],[responsive-image]');
|
||||
for (var i = 0, j = elements.length; i < j; i++) {
|
||||
attachResponsiveImage(elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var regex = /,?[\s\t]*([^,\n]*?)((?:\[[\s\t]*?(?:min|max)-(?:width|height)[\s\t]*?[~$\^]?=[\s\t]*?"[^"]*?"[\s\t]*?])+)([^,\n\s\{]*)/mgi;
|
||||
var attrRegex = /\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]/mgi;
|
||||
/**
|
||||
* @param {String} css
|
||||
*/
|
||||
function extractQuery(css) {
|
||||
var match;
|
||||
var smatch;
|
||||
css = css.replace(/'/g, '"');
|
||||
while (null !== (match = regex.exec(css))) {
|
||||
smatch = match[1] + match[3];
|
||||
attrs = match[2];
|
||||
|
||||
while (null !== (attrMatch = attrRegex.exec(attrs))) {
|
||||
queueQuery(smatch, attrMatch[1], attrMatch[2], attrMatch[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {CssRule[]|String} rules
|
||||
*/
|
||||
function readRules(rules) {
|
||||
var selector = '';
|
||||
if (!rules) {
|
||||
return;
|
||||
}
|
||||
if ('string' === typeof rules) {
|
||||
rules = rules.toLowerCase();
|
||||
if (-1 !== rules.indexOf('min-width') || -1 !== rules.indexOf('max-width')) {
|
||||
extractQuery(rules);
|
||||
}
|
||||
} else {
|
||||
for (var i = 0, j = rules.length; i < j; i++) {
|
||||
if (1 === rules[i].type) {
|
||||
selector = rules[i].selectorText || rules[i].cssText;
|
||||
if (-1 !== selector.indexOf('min-height') || -1 !== selector.indexOf('max-height')) {
|
||||
extractQuery(selector);
|
||||
}else if(-1 !== selector.indexOf('min-width') || -1 !== selector.indexOf('max-width')) {
|
||||
extractQuery(selector);
|
||||
}
|
||||
} else if (4 === rules[i].type) {
|
||||
readRules(rules[i].cssRules || rules[i].rules);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var defaultCssInjected = false;
|
||||
|
||||
/**
|
||||
* Searches all css rules and setups the event listener to all elements with element query rules..
|
||||
*
|
||||
* @param {Boolean} withTracking allows and requires you to use detach, since we store internally all used elements
|
||||
* (no garbage collection possible if you don not call .detach() first)
|
||||
*/
|
||||
this.init = function(withTracking) {
|
||||
trackingActive = typeof withTracking === 'undefined' ? false : withTracking;
|
||||
|
||||
for (var i = 0, j = document.styleSheets.length; i < j; i++) {
|
||||
try {
|
||||
readRules(document.styleSheets[i].cssRules || document.styleSheets[i].rules || document.styleSheets[i].cssText);
|
||||
} catch(e) {
|
||||
if (e.name !== 'SecurityError') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!defaultCssInjected) {
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
style.innerHTML = '[responsive-image] > img, [data-responsive-image] {overflow: hidden; padding: 0; } [responsive-image] > img, [data-responsive-image] > img { width: 100%;}';
|
||||
document.getElementsByTagName('head')[0].appendChild(style);
|
||||
defaultCssInjected = true;
|
||||
}
|
||||
|
||||
findElementQueriesElements();
|
||||
findResponsiveImages();
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Boolean} withTracking allows and requires you to use detach, since we store internally all used elements
|
||||
* (no garbage collection possible if you don not call .detach() first)
|
||||
*/
|
||||
this.update = function(withTracking) {
|
||||
this.init(withTracking);
|
||||
};
|
||||
|
||||
this.detach = function() {
|
||||
if (!this.withTracking) {
|
||||
throw 'withTracking is not enabled. We can not detach elements since we don not store it.' +
|
||||
'Use ElementQueries.withTracking = true; before domready or call ElementQueryes.update(true).';
|
||||
}
|
||||
|
||||
var element;
|
||||
while (element = elements.pop()) {
|
||||
ElementQueries.detach(element);
|
||||
}
|
||||
|
||||
elements = [];
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Boolean} withTracking allows and requires you to use detach, since we store internally all used elements
|
||||
* (no garbage collection possible if you don not call .detach() first)
|
||||
*/
|
||||
ElementQueries.update = function(withTracking) {
|
||||
ElementQueries.instance.update(withTracking);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all sensor and elementquery information from the element.
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
*/
|
||||
ElementQueries.detach = function(element) {
|
||||
if (element.elementQueriesSetupInformation) {
|
||||
//element queries
|
||||
element.elementQueriesSensor.detach();
|
||||
delete element.elementQueriesSetupInformation;
|
||||
delete element.elementQueriesSensor;
|
||||
|
||||
} else if (element.resizeSensor) {
|
||||
//responsive image
|
||||
|
||||
element.resizeSensor.detach();
|
||||
delete element.resizeSensor;
|
||||
} else {
|
||||
//console.log('detached already', element);
|
||||
}
|
||||
};
|
||||
|
||||
ElementQueries.withTracking = false;
|
||||
|
||||
ElementQueries.init = function() {
|
||||
if (!ElementQueries.instance) {
|
||||
ElementQueries.instance = new ElementQueries();
|
||||
}
|
||||
|
||||
ElementQueries.instance.init(ElementQueries.withTracking);
|
||||
};
|
||||
|
||||
var domLoaded = function (callback) {
|
||||
/* Internet Explorer */
|
||||
/*@cc_on
|
||||
@if (@_win32 || @_win64)
|
||||
document.write('<script id="ieScriptLoad" defer src="//:"><\/script>');
|
||||
document.getElementById('ieScriptLoad').onreadystatechange = function() {
|
||||
if (this.readyState == 'complete') {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
@end @*/
|
||||
/* Mozilla, Chrome, Opera */
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('DOMContentLoaded', callback, false);
|
||||
}
|
||||
/* Safari, iCab, Konqueror */
|
||||
else if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) {
|
||||
var DOMLoadTimer = setInterval(function () {
|
||||
if (/loaded|complete/i.test(document.readyState)) {
|
||||
callback();
|
||||
clearInterval(DOMLoadTimer);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
/* Other web browsers */
|
||||
else window.onload = callback;
|
||||
};
|
||||
|
||||
ElementQueries.listen = function() {
|
||||
domLoaded(ElementQueries.init);
|
||||
};
|
||||
|
||||
// make available to common module loader
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = ElementQueries;
|
||||
}
|
||||
else {
|
||||
window.ElementQueries = ElementQueries;
|
||||
ElementQueries.listen();
|
||||
}
|
||||
|
||||
return ElementQueries;
|
||||
|
||||
}));
|
||||
227
public/js/resize/ResizeSensor.js
Normal file
227
public/js/resize/ResizeSensor.js
Normal file
@@ -0,0 +1,227 @@
|
||||
/**
|
||||
* Copyright Marc J. Schmidt. See the LICENSE file at the top-level
|
||||
* directory of this distribution and at
|
||||
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
|
||||
*/
|
||||
;
|
||||
(function (root, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(factory);
|
||||
} else if (typeof exports === "object") {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
root.ResizeSensor = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
//Make sure it does not throw in a SSR (Server Side Rendering) situation
|
||||
if (typeof window === "undefined") {
|
||||
return null;
|
||||
}
|
||||
// Only used for the dirty checking, so the event callback count is limted to max 1 call per fps per sensor.
|
||||
// In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
|
||||
// would generate too many unnecessary events.
|
||||
var requestAnimationFrame = window.requestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
function (fn) {
|
||||
return window.setTimeout(fn, 20);
|
||||
};
|
||||
|
||||
/**
|
||||
* Iterate over each of the provided element(s).
|
||||
*
|
||||
* @param {HTMLElement|HTMLElement[]} elements
|
||||
* @param {Function} callback
|
||||
*/
|
||||
function forEachElement(elements, callback){
|
||||
var elementsType = Object.prototype.toString.call(elements);
|
||||
var isCollectionTyped = ('[object Array]' === elementsType
|
||||
|| ('[object NodeList]' === elementsType)
|
||||
|| ('[object HTMLCollection]' === elementsType)
|
||||
|| ('[object Object]' === elementsType)
|
||||
|| ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery
|
||||
|| ('undefined' !== typeof Elements && elements instanceof Elements) //mootools
|
||||
);
|
||||
var i = 0, j = elements.length;
|
||||
if (isCollectionTyped) {
|
||||
for (; i < j; i++) {
|
||||
callback(elements[i]);
|
||||
}
|
||||
} else {
|
||||
callback(elements);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for dimension change detection.
|
||||
*
|
||||
* @param {Element|Element[]|Elements|jQuery} element
|
||||
* @param {Function} callback
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
var ResizeSensor = function(element, callback) {
|
||||
/**
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function EventQueue() {
|
||||
var q = [];
|
||||
this.add = function(ev) {
|
||||
q.push(ev);
|
||||
};
|
||||
|
||||
var i, j;
|
||||
this.call = function() {
|
||||
for (i = 0, j = q.length; i < j; i++) {
|
||||
q[i].call();
|
||||
}
|
||||
};
|
||||
|
||||
this.remove = function(ev) {
|
||||
var newQueue = [];
|
||||
for(i = 0, j = q.length; i < j; i++) {
|
||||
if(q[i] !== ev) newQueue.push(q[i]);
|
||||
}
|
||||
q = newQueue;
|
||||
}
|
||||
|
||||
this.length = function() {
|
||||
return q.length;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} element
|
||||
* @param {String} prop
|
||||
* @returns {String|Number}
|
||||
*/
|
||||
function getComputedStyle(element, prop) {
|
||||
if (element.currentStyle) {
|
||||
return element.currentStyle[prop];
|
||||
} else if (window.getComputedStyle) {
|
||||
return window.getComputedStyle(element, null).getPropertyValue(prop);
|
||||
} else {
|
||||
return element.style[prop];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @param {Function} resized
|
||||
*/
|
||||
function attachResizeEvent(element, resized) {
|
||||
if (!element.resizedAttached) {
|
||||
element.resizedAttached = new EventQueue();
|
||||
element.resizedAttached.add(resized);
|
||||
} else if (element.resizedAttached) {
|
||||
element.resizedAttached.add(resized);
|
||||
return;
|
||||
}
|
||||
|
||||
element.resizeSensor = document.createElement('div');
|
||||
element.resizeSensor.className = 'resize-sensor';
|
||||
var style = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;';
|
||||
var styleChild = 'position: absolute; left: 0; top: 0; transition: 0s;';
|
||||
|
||||
element.resizeSensor.style.cssText = style;
|
||||
element.resizeSensor.innerHTML =
|
||||
'<div class="resize-sensor-expand" style="' + style + '">' +
|
||||
'<div style="' + styleChild + '"></div>' +
|
||||
'</div>' +
|
||||
'<div class="resize-sensor-shrink" style="' + style + '">' +
|
||||
'<div style="' + styleChild + ' width: 200%; height: 200%"></div>' +
|
||||
'</div>';
|
||||
element.appendChild(element.resizeSensor);
|
||||
|
||||
if (getComputedStyle(element, 'position') == 'static') {
|
||||
element.style.position = 'relative';
|
||||
}
|
||||
|
||||
var expand = element.resizeSensor.childNodes[0];
|
||||
var expandChild = expand.childNodes[0];
|
||||
var shrink = element.resizeSensor.childNodes[1];
|
||||
var dirty, rafId, newWidth, newHeight;
|
||||
var lastWidth = element.offsetWidth;
|
||||
var lastHeight = element.offsetHeight;
|
||||
|
||||
var reset = function() {
|
||||
expandChild.style.width = '100000px';
|
||||
expandChild.style.height = '100000px';
|
||||
|
||||
expand.scrollLeft = 100000;
|
||||
expand.scrollTop = 100000;
|
||||
|
||||
shrink.scrollLeft = 100000;
|
||||
shrink.scrollTop = 100000;
|
||||
};
|
||||
|
||||
reset();
|
||||
|
||||
var onResized = function() {
|
||||
rafId = 0;
|
||||
|
||||
if (!dirty) return;
|
||||
|
||||
lastWidth = newWidth;
|
||||
lastHeight = newHeight;
|
||||
|
||||
if (element.resizedAttached) {
|
||||
element.resizedAttached.call();
|
||||
}
|
||||
};
|
||||
|
||||
var onScroll = function() {
|
||||
newWidth = element.offsetWidth;
|
||||
newHeight = element.offsetHeight;
|
||||
dirty = newWidth != lastWidth || newHeight != lastHeight;
|
||||
|
||||
if (dirty && !rafId) {
|
||||
rafId = requestAnimationFrame(onResized);
|
||||
}
|
||||
|
||||
reset();
|
||||
};
|
||||
|
||||
var addEvent = function(el, name, cb) {
|
||||
if (el.attachEvent) {
|
||||
el.attachEvent('on' + name, cb);
|
||||
} else {
|
||||
el.addEventListener(name, cb);
|
||||
}
|
||||
};
|
||||
|
||||
addEvent(expand, 'scroll', onScroll);
|
||||
addEvent(shrink, 'scroll', onScroll);
|
||||
}
|
||||
|
||||
forEachElement(element, function(elem){
|
||||
attachResizeEvent(elem, callback);
|
||||
});
|
||||
|
||||
this.detach = function(ev) {
|
||||
ResizeSensor.detach(element, ev);
|
||||
};
|
||||
};
|
||||
|
||||
ResizeSensor.detach = function(element, ev) {
|
||||
forEachElement(element, function(elem){
|
||||
if(elem.resizedAttached && typeof ev == "function"){
|
||||
elem.resizedAttached.remove(ev);
|
||||
if(elem.resizedAttached.length()) return;
|
||||
}
|
||||
if (elem.resizeSensor) {
|
||||
if (elem.contains(elem.resizeSensor)) {
|
||||
elem.removeChild(elem.resizeSensor);
|
||||
}
|
||||
delete elem.resizeSensor;
|
||||
delete elem.resizedAttached;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return ResizeSensor;
|
||||
|
||||
}));
|
||||
Reference in New Issue
Block a user