Last active
April 6, 2016 22:40
-
-
Save Mbrownshoes/6da08c45b82ff4ae6afd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: jquery.dataTables.columnFilter.js | |
* Version: 1.5.6. | |
* Author: Jovan Popovic | |
* | |
* Copyright 2011-2014 Jovan Popovic, all rights reserved. | |
* | |
* This source file is free software, under either the GPL v2 license or a | |
* BSD style license, as supplied with this software. | |
* | |
* This source file is distributed in the hope that it will be useful, but | |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
* or FITNESS FOR A PARTICULAR PURPOSE. | |
* | |
* Parameters:" | |
* @sPlaceHolder String Place where inline filtering function should be placed ("tfoot", "thead:before", "thead:after"). Default is "tfoot" | |
* @sRangeSeparator String Separator that will be used when range values are sent to the server-side. Default value is "~". | |
* @sRangeFormat string Default format of the From ... to ... range inputs. Default is From {from} to {to} | |
* @aoColumns Array Array of the filter settings that will be applied on the columns | |
*/ | |
(function ($) { | |
$.fn.columnFilter = function (options) { | |
var asInitVals, i, label, th; | |
//var sTableId = "table"; | |
var sRangeFormat = "From {from} to {to}"; | |
//Array of the functions that will override sSearch_ parameters | |
var afnSearch_ = new Array(); | |
var aiCustomSearch_Indexes = new Array(); | |
var oFunctionTimeout = null; | |
var fnOnFiltered = function () { }; | |
function _fnGetColumnValues(oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty) { | |
///<summary> | |
///Return values in the column | |
///</summary> | |
///<param name="oSettings" type="Object">DataTables settings</param> | |
///<param name="iColumn" type="int">Id of the column</param> | |
///<param name="bUnique" type="bool">Return only distinct values</param> | |
///<param name="bFiltered" type="bool">Return values only from the filtered rows</param> | |
///<param name="bIgnoreEmpty" type="bool">Ignore empty cells</param> | |
// check that we have a column id | |
if (typeof iColumn == "undefined") return new Array(); | |
// by default we only wany unique data | |
if (typeof bUnique == "undefined") bUnique = true; | |
// by default we do want to only look at filtered data | |
if (typeof bFiltered == "undefined") bFiltered = true; | |
// by default we do not wany to include empty values | |
if (typeof bIgnoreEmpty == "undefined") bIgnoreEmpty = true; | |
// list of rows which we're going to loop through | |
var aiRows; | |
// use only filtered rows | |
if (bFiltered == true) aiRows = oSettings.aiDisplay; | |
// use all rows | |
else aiRows = oSettings.aiDisplayMaster; // all row numbers | |
// set up data array | |
var asResultData = new Array(); | |
for (var i = 0, c = aiRows.length; i < c; i++) { | |
var iRow = aiRows[i]; | |
var aData = oTable.fnGetData(iRow); | |
var sValue = aData[iColumn]; | |
// ignore empty values? | |
if (bIgnoreEmpty == true && sValue.length == 0) continue; | |
// ignore unique values? | |
else if (bUnique == true && jQuery.inArray(sValue, asResultData) > -1) continue; | |
// else push the value onto the result data array | |
else asResultData.push(sValue); | |
} | |
return asResultData.sort(); | |
} | |
function _fnColumnIndex(iColumnIndex) { | |
if (properties.bUseColVis) | |
return iColumnIndex; | |
else | |
return oTable.fnSettings().oApi._fnVisibleToColumnIndex(oTable.fnSettings(), iColumnIndex); | |
//return iColumnIndex; | |
//return oTable.fnSettings().oApi._fnColumnIndexToVisible(oTable.fnSettings(), iColumnIndex); | |
} | |
function fnCreateInput(oTable, regex, smart, bIsNumber, iFilterLength, iMaxLenght) { | |
var sCSSClass = "text_filter form-control"; | |
if (bIsNumber) | |
sCSSClass = "number_filter form-control"; | |
label = label.replace(/(^\s*)|(\s*$)/g, ""); | |
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch; | |
var search_init = 'search_init '; | |
var inputvalue = label; | |
if (currentFilter != '' && currentFilter != '^') { | |
if (bIsNumber && currentFilter.charAt(0) == '^') | |
inputvalue = currentFilter.substr(1); //ignore trailing ^ | |
else | |
inputvalue = currentFilter; | |
search_init = ''; | |
} | |
var input = $('<input type="text" class="' + search_init + sCSSClass + '" value="' + inputvalue + '" rel="' + i + '"/>'); | |
if (iMaxLenght != undefined && iMaxLenght != -1) { | |
input.attr('maxlength', iMaxLenght); | |
} | |
th.html(input); | |
if (bIsNumber) | |
th.wrapInner('<span class="filter_column filter_number" />'); | |
else | |
th.wrapInner('<span class="filter_column filter_text" />'); | |
asInitVals[i] = label; | |
var index = i; | |
if (bIsNumber && !oTable.fnSettings().oFeatures.bServerSide) { | |
input.keyup(function () { | |
/* Filter on the column all numbers that starts with the entered value */ | |
oTable.fnFilter('^' + this.value, _fnColumnIndex(index), true, false); //Issue 37 | |
fnOnFiltered(); | |
}); | |
} else { | |
input.keyup(function () { | |
if (oTable.fnSettings().oFeatures.bServerSide && iFilterLength != 0) { | |
//If filter length is set in the server-side processing mode | |
//Check has the user entered at least iFilterLength new characters | |
var currentFilter = oTable.fnSettings().aoPreSearchCols[index].sSearch; | |
var iLastFilterLength = $(this).data("dt-iLastFilterLength"); | |
if (typeof iLastFilterLength == "undefined") | |
iLastFilterLength = 0; | |
var iCurrentFilterLength = this.value.length; | |
if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength | |
//&& currentFilter.length == 0 //Why this? | |
) { | |
//Cancel the filtering | |
return; | |
} | |
else { | |
//Remember the current filter length | |
$(this).data("dt-iLastFilterLength", iCurrentFilterLength); | |
} | |
} | |
/* Filter on the column (the index) of this element */ | |
oTable.fnFilter(this.value, _fnColumnIndex(index), regex, smart); //Issue 37 | |
fnOnFiltered(); | |
}); | |
} | |
input.focus(function () { | |
if ($(this).hasClass("search_init")) { | |
$(this).removeClass("search_init"); | |
this.value = ""; | |
} | |
}); | |
input.blur(function () { | |
if (this.value == "") { | |
$(this).addClass("search_init"); | |
this.value = asInitVals[index]; | |
} | |
}); | |
} | |
function fnCreateRangeInput(oTable) { | |
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch; | |
th.html(_fnRangeLabelPart(0)); | |
var sFromId = oTable.attr("id") + '_range_from_' + i; | |
var from = $('<input type="text" class="number_range_filter form-control" id="' + sFromId + '" rel="' + i + '"/>'); | |
th.append(from); | |
th.append(_fnRangeLabelPart(1)); | |
var sToId = oTable.attr("id") + '_range_to_' + i; | |
var to = $('<input type="text" class="number_range_filter form-control" id="' + sToId + '" rel="' + i + '"/>'); | |
th.append(to); | |
th.append(_fnRangeLabelPart(2)); | |
th.wrapInner('<span class="filter_column filter_number_range form-control" />'); | |
var index = i; | |
aiCustomSearch_Indexes.push(i); | |
//------------start range filtering function | |
/* Custom filtering function which will filter data in column four between two values | |
* Author: Allan Jardine, Modified by Jovan Popovic | |
*/ | |
//$.fn.dataTableExt.afnFiltering.push( | |
oTable.dataTableExt.afnFiltering.push( | |
function (oSettings, aData, iDataIndex) { | |
if (oTable.attr("id") != oSettings.sTableId) | |
return true; | |
// Try to handle missing nodes more gracefully | |
if (document.getElementById(sFromId) == null) | |
return true; | |
var iMin = document.getElementById(sFromId).value * 1; | |
var iMax = document.getElementById(sToId).value * 1; | |
var iValue = aData[_fnColumnIndex(index)] == "-" ? 0 : aData[_fnColumnIndex(index)] * 1; | |
if (iMin == "" && iMax == "") { | |
return true; | |
} | |
else if (iMin == "" && iValue <= iMax) { | |
return true; | |
} | |
else if (iMin <= iValue && "" == iMax) { | |
return true; | |
} | |
else if (iMin <= iValue && iValue <= iMax) { | |
return true; | |
} | |
return false; | |
} | |
); | |
//------------end range filtering function | |
$('#' + sFromId + ',#' + sToId, th).keyup(function () { | |
var iMin = document.getElementById(sFromId).value * 1; | |
var iMax = document.getElementById(sToId).value * 1; | |
if (iMin != 0 && iMax != 0 && iMin > iMax) | |
return; | |
oTable.fnDraw(); | |
fnOnFiltered(); | |
}); | |
} | |
function fnCreateDateRangeInput(oTable) { | |
var aoFragments = sRangeFormat.split(/[}{]/); | |
th.html(""); | |
//th.html(_fnRangeLabelPart(0)); | |
var sFromId = oTable.attr("id") + '_range_from_' + i; | |
var from = $('<input type="text" class="date_range_filter form-control" id="' + sFromId + '" rel="' + i + '"/>'); | |
from.datepicker(); | |
//th.append(from); | |
//th.append(_fnRangeLabelPart(1)); | |
var sToId = oTable.attr("id") + '_range_to_' + i; | |
var to = $('<input type="text" class="date_range_filter form-control" id="' + sToId + '" rel="' + i + '"/>'); | |
//th.append(to); | |
//th.append(_fnRangeLabelPart(2)); | |
for (ti = 0; ti < aoFragments.length; ti++) { | |
if (aoFragments[ti] == properties.sDateFromToken) { | |
th.append(from); | |
} else { | |
if (aoFragments[ti] == properties.sDateToToken) { | |
th.append(to); | |
} else { | |
th.append(aoFragments[ti]); | |
} | |
} | |
} | |
th.wrapInner('<span class="filter_column filter_date_range" />'); | |
to.datepicker(); | |
var index = i; | |
aiCustomSearch_Indexes.push(i); | |
//------------start date range filtering function | |
//$.fn.dataTableExt.afnFiltering.push( | |
oTable.dataTableExt.afnFiltering.push( | |
function (oSettings, aData, iDataIndex) { | |
if (oTable.attr("id") != oSettings.sTableId) | |
return true; | |
var dStartDate = from.datepicker("getDate"); | |
var dEndDate = to.datepicker("getDate"); | |
if (dStartDate == null && dEndDate == null) { | |
return true; | |
} | |
var dCellDate = null; | |
try { | |
if (aData[_fnColumnIndex(index)] == null || aData[_fnColumnIndex(index)] == "") | |
return false; | |
dCellDate = $.datepicker.parseDate($.datepicker.regional[""].dateFormat, aData[_fnColumnIndex(index)]); | |
} catch (ex) { | |
return false; | |
} | |
if (dCellDate == null) | |
return false; | |
if (dStartDate == null && dCellDate <= dEndDate) { | |
return true; | |
} | |
else if (dStartDate <= dCellDate && dEndDate == null) { | |
return true; | |
} | |
else if (dStartDate <= dCellDate && dCellDate <= dEndDate) { | |
return true; | |
} | |
return false; | |
} | |
); | |
//------------end date range filtering function | |
$('#' + sFromId + ',#' + sToId, th).change(function () { | |
oTable.fnDraw(); | |
fnOnFiltered(); | |
}); | |
} | |
function fnCreateColumnSelect(oTable, aData, iColumn, nTh, sLabel, bRegex, oSelected, bMultiselect) { | |
if (aData == null) | |
aData = _fnGetColumnValues(oTable.fnSettings(), iColumn, true, false, true); | |
var index = iColumn; | |
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch; | |
if (currentFilter == null || currentFilter == "")//Issue 81 | |
currentFilter = oSelected; | |
var r = '<select class="search_init select_filter form-control" rel="' + i + '"><option value="" class="search_init">' + sLabel + '</option>'; | |
if(bMultiselect) { | |
r = '<select class="search_init select_filter form-control" rel="' + i + '" multiple>'; | |
} | |
var j = 0; | |
var iLen = aData.length; | |
for (j = 0; j < iLen; j++) { | |
if (typeof (aData[j]) != 'object') { | |
var selected = ''; | |
if (escape(aData[j]) == currentFilter | |
|| escape(aData[j]) == escape(currentFilter) | |
) | |
selected = 'selected ' | |
r += '<option ' + selected + ' value="' + escape(aData[j]) + '">' + aData[j] + '</option>'; | |
} | |
else { | |
var selected = ''; | |
if (bRegex) { | |
//Do not escape values if they are explicitely set to avoid escaping special characters in the regexp | |
if (aData[j].value == currentFilter) selected = 'selected '; | |
r += '<option ' + selected + 'value="' + aData[j].value + '">' + aData[j].label + '</option>'; | |
} else { | |
if (escape(aData[j].value) == currentFilter) selected = 'selected '; | |
r += '<option ' + selected + 'value="' + escape(aData[j].value) + '">' + aData[j].label + '</option>'; | |
} | |
} | |
} | |
var select = $(r + '</select>'); | |
nTh.html(select); | |
nTh.wrapInner('<span class="filter_column filter_select" />'); | |
if(bMultiselect) { | |
select.change(function () { | |
if ($(this).val() != "") { | |
$(this).removeClass("search_init"); | |
} else { | |
$(this).addClass("search_init"); | |
} | |
var selectedOptions = $(this).val(); | |
var asEscapedFilters = []; | |
if(selectedOptions==null || selectedOptions==[]){ | |
var re = '^(.*)$'; | |
}else{ | |
$.each( selectedOptions, function( i, sFilter ) { | |
asEscapedFilters.push( fnRegExpEscape( sFilter ) ); | |
} ); | |
var re = '^(' + asEscapedFilters.join('|') + ')$'; | |
} | |
oTable.fnFilter( re, index, true, false ); | |
}); | |
} else { | |
select.change(function () { | |
//var val = $(this).val(); | |
if ($(this).val() != "") { | |
$(this).removeClass("search_init"); | |
} else { | |
$(this).addClass("search_init"); | |
} | |
if (bRegex) | |
oTable.fnFilter($(this).val(), iColumn, bRegex); //Issue 41 | |
else | |
oTable.fnFilter(unescape($(this).val()), iColumn); //Issue 25 | |
fnOnFiltered(); | |
}); | |
if (currentFilter != null && currentFilter != "")//Issue 81 | |
oTable.fnFilter(unescape(currentFilter), iColumn); | |
} | |
} | |
function fnCreateSelect(oTable, aData, bRegex, oSelected, bMultiselect) { | |
var oSettings = oTable.fnSettings(); | |
if ( (aData == null || typeof(aData) == 'function' ) && oSettings.sAjaxSource != "" && !oSettings.oFeatures.bServerSide) { | |
// Add a function to the draw callback, which will check for the Ajax data having | |
// been loaded. Use a closure for the individual column elements that are used to | |
// built the column filter, since 'i' and 'th' (etc) are locally "global". | |
oSettings.aoDrawCallback.push({ | |
"fn": (function (iColumn, nTh, sLabel) { | |
return function (oSettings) { | |
// Only rebuild the select on the second draw - i.e. when the Ajax | |
// data has been loaded. | |
if (oSettings.iDraw == 2 && oSettings.sAjaxSource != null && oSettings.sAjaxSource != "" && !oSettings.oFeatures.bServerSide) { | |
return fnCreateColumnSelect(oTable, aData && aData(oSettings.aoData, oSettings), _fnColumnIndex(iColumn), nTh, sLabel, bRegex, oSelected, bMultiselect); //Issue 37 | |
} | |
}; | |
})(i, th, label), | |
"sName": "column_filter_" + i | |
}); | |
} | |
// Regardless of the Ajax state, build the select on first pass | |
fnCreateColumnSelect(oTable, typeof(aData) == 'function' ? null: aData, _fnColumnIndex(i), th, label, bRegex, oSelected, bMultiselect); //Issue 37 | |
} | |
function fnRegExpEscape( sText ) { | |
return sText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); | |
}; | |
function fnCreateDropdown(aData) { | |
var index = i; | |
var r = '<div class="dropdown select_filter form-control"><a class="dropdown-toggle" data-toggle="dropdown" href="#">' + label + '<b class="caret"></b></a><ul class="dropdown-menu" role="menu"><li data-value=""><a>Show All</a></li>', j, iLen = aData.length; | |
for (j = 0; j < iLen; j++) { | |
r += '<li data-value="' + aData[j] + '"><a>' + aData[j] + '</a></li>'; | |
} | |
var select = $(r + '</ul></div>'); | |
th.html(select); | |
th.wrapInner('<span class="filterColumn filter_select" />'); | |
select.find('li').click(function () { | |
oTable.fnFilter($(this).data('value'), index); | |
}); | |
} | |
function fnCreateCheckbox(oTable, aData) { | |
if (aData == null) | |
aData = _fnGetColumnValues(oTable.fnSettings(), i, true, true, true); | |
var index = i; | |
var r = '', j, iLen = aData.length; | |
//clean the string | |
var localLabel = label.replace('%', 'Perc').replace("&", "AND").replace("$", "DOL").replace("£", "STERL").replace("@", "AT").replace(/\s/g, "_"); | |
localLabel = localLabel.replace(/[^a-zA-Z 0-9]+/g, ''); | |
//clean the string | |
//button label override | |
var labelBtn = label; | |
if (properties.sFilterButtonText != null || properties.sFilterButtonText != undefined) { | |
labelBtn = properties.sFilterButtonText; | |
} | |
var relativeDivWidthToggleSize = 10; | |
var numRow = 12; //numero di checkbox per colonna | |
var numCol = Math.floor(iLen / numRow); | |
if (iLen % numRow > 0) { | |
numCol = numCol + 1; | |
}; | |
//count how many column should be generated and split the div size | |
var divWidth = 100 / numCol - 2; | |
var divWidthToggle = relativeDivWidthToggleSize * numCol; | |
if (numCol == 1) { | |
divWidth = 20; | |
} | |
var divRowDef = '<div style="float:left; min-width: ' + divWidth + '%; " >'; | |
var divClose = '</div>'; | |
var uniqueId = oTable.attr("id") + localLabel; | |
var buttonId = "chkBtnOpen" + uniqueId; | |
var checkToggleDiv = uniqueId + "-flt-toggle"; | |
r += '<button id="' + buttonId + '" class="checkbox_filter btn btn-default" > ' + labelBtn + '</button>'; //filter button witch open dialog | |
r += '<div id="' + checkToggleDiv + '" ' | |
+ 'title="' + label + '" ' | |
+ 'rel="' + i + '" ' | |
+ 'class="toggle-check ui-widget-content ui-corner-all" style="width: ' + (divWidthToggle) + '%; " >'; //dialog div | |
//r+= '<div align="center" style="margin-top: 5px; "> <button id="'+buttonId+'Reset" class="checkbox_filter" > reset </button> </div>'; //reset button and its div | |
r += divRowDef; | |
for (j = 0; j < iLen; j++) { | |
//if last check close div | |
if (j % numRow == 0 && j != 0) { | |
r += divClose + divRowDef; | |
} | |
var sLabel = aData[j]; | |
var sValue = aData[j]; | |
if (typeof (aData[j]) == 'object') { | |
sLabel = aData[j].label; | |
sValue = aData[j].value; | |
} | |
//check button | |
r += '<input class="search_init checkbox_filter btn btn-default" type="checkbox" id= "' + uniqueId + '_cb_' + sValue + '" name= "' + localLabel + '" value="' + sValue + '" >' + sLabel + '<br/>'; | |
var checkbox = $(r); | |
th.html(checkbox); | |
th.wrapInner('<span class="filter_column filter_checkbox" />'); | |
//on every checkbox selection | |
checkbox.change(function () { | |
var search = ''; | |
var or = '|'; //var for select checks in 'or' into the regex | |
var resSize = $('input:checkbox[name="' + localLabel + '"]:checked').size(); | |
$('input:checkbox[name="' + localLabel + '"]:checked').each(function (index) { | |
//search = search + ' ' + $(this).val(); | |
//concatenation for selected checks in or | |
if ((index == 0 && resSize == 1) | |
|| (index != 0 && index == resSize - 1)) { | |
or = ''; | |
} | |
//trim | |
search = search.replace(/^\s+|\s+$/g, ""); | |
search = search + $(this).val() + or; | |
or = '|'; | |
}); | |
if (search != "") { | |
$('input:checkbox[name="' + localLabel + '"]').removeClass("search_init"); | |
} else { | |
$('input:checkbox[name="' + localLabel + '"]').addClass("search_init"); | |
} | |
/* Old code for setting search_init CSS class on checkboxes if any of them is checked | |
for (var jj = 0; jj < iLen; jj++) { | |
if (search != "") { | |
$('#' + aData[jj]).removeClass("search_init"); | |
} else { | |
$('#' + aData[jj]).addClass("search_init"); | |
} | |
} | |
*/ | |
//execute search | |
oTable.fnFilter(search, index, true, false); | |
fnOnFiltered(); | |
}); | |
} | |
//filter button | |
$('#' + buttonId).button(); | |
//dialog | |
$('#' + checkToggleDiv).dialog({ | |
//height: 140, | |
autoOpen: false, | |
//show: "blind", | |
hide: "blind", | |
buttons: [{ | |
text: "Reset", | |
click: function () { | |
//$('#'+buttonId).removeClass("filter_selected"); //LM remove border if filter selected | |
$('input:checkbox[name="' + localLabel + '"]:checked').each(function (index3) { | |
$(this).attr('checked', false); | |
$(this).addClass("search_init"); | |
}); | |
oTable.fnFilter('', index, true, false); | |
fnOnFiltered(); | |
return false; | |
} | |
}, | |
{ | |
text: "Close", | |
click: function () { $(this).dialog("close"); } | |
} | |
] | |
}); | |
$('#' + buttonId).click(function () { | |
$('#' + checkToggleDiv).dialog('open'); | |
var target = $(this); | |
$('#' + checkToggleDiv).dialog("widget").position({ my: 'top', | |
at: 'bottom', | |
of: target | |
}); | |
return false; | |
}); | |
var fnOnFilteredCurrent = fnOnFiltered; | |
fnOnFiltered = function () { | |
var target = $('#' + buttonId); | |
$('#' + checkToggleDiv).dialog("widget").position({ my: 'top', | |
at: 'bottom', | |
of: target | |
}); | |
fnOnFilteredCurrent(); | |
}; | |
//reset | |
/* | |
$('#'+buttonId+"Reset").button(); | |
$('#'+buttonId+"Reset").click(function(){ | |
$('#'+buttonId).removeClass("filter_selected"); //LM remove border if filter selected | |
$('input:checkbox[name="'+localLabel+'"]:checked').each(function(index3) { | |
$(this).attr('checked', false); | |
$(this).addClass("search_init"); | |
}); | |
oTable.fnFilter('', index, true, false); | |
return false; | |
}); | |
*/ | |
} | |
function _fnRangeLabelPart(iPlace) { | |
switch (iPlace) { | |
case 0: | |
return sRangeFormat.substring(0, sRangeFormat.indexOf("{from}")); | |
case 1: | |
return sRangeFormat.substring(sRangeFormat.indexOf("{from}") + 6, sRangeFormat.indexOf("{to}")); | |
default: | |
return sRangeFormat.substring(sRangeFormat.indexOf("{to}") + 4); | |
} | |
} | |
var oTable = this; | |
var defaults = { | |
sPlaceHolder: "foot", | |
sRangeSeparator: "~", | |
iFilteringDelay: 500, | |
aoColumns: null, | |
sRangeFormat: "From {from} to {to}", | |
sDateFromToken: "from", | |
sDateToToken: "to" | |
}; | |
var properties = $.extend(defaults, options); | |
return this.each(function () { | |
if (!oTable.fnSettings().oFeatures.bFilter) | |
return; | |
asInitVals = new Array(); | |
var aoFilterCells = oTable.fnSettings().aoFooter[0]; | |
var oHost = oTable.fnSettings().nTFoot; //Before fix for ColVis | |
var sFilterRow = "tr"; //Before fix for ColVis | |
if (properties.sPlaceHolder == "head:after") { | |
var tr = $("tr:first", oTable.fnSettings().nTHead).detach(); | |
//tr.appendTo($(oTable.fnSettings().nTHead)); | |
if (oTable.fnSettings().bSortCellsTop) { | |
tr.prependTo($(oTable.fnSettings().nTHead)); | |
//tr.appendTo($("thead", oTable)); | |
aoFilterCells = oTable.fnSettings().aoHeader[1]; | |
} | |
else { | |
tr.appendTo($(oTable.fnSettings().nTHead)); | |
//tr.prependTo($("thead", oTable)); | |
aoFilterCells = oTable.fnSettings().aoHeader[0]; | |
} | |
sFilterRow = "tr:last"; | |
oHost = oTable.fnSettings().nTHead; | |
} else if (properties.sPlaceHolder == "head:before") { | |
if (oTable.fnSettings().bSortCellsTop) { | |
var tr = $("tr:first", oTable.fnSettings().nTHead).detach(); | |
tr.appendTo($(oTable.fnSettings().nTHead)); | |
aoFilterCells = oTable.fnSettings().aoHeader[1]; | |
} else { | |
aoFilterCells = oTable.fnSettings().aoHeader[0]; | |
} | |
/*else { | |
//tr.prependTo($("thead", oTable)); | |
sFilterRow = "tr:first"; | |
}*/ | |
sFilterRow = "tr:first"; | |
oHost = oTable.fnSettings().nTHead; | |
} | |
//$(sFilterRow + " th", oHost).each(function (index) {//bug with ColVis | |
$(aoFilterCells).each(function (index) {//fix for ColVis | |
i = index; | |
var aoColumn = { type: "text", | |
bRegex: false, | |
bSmart: true, | |
iMaxLenght: -1, | |
iFilterLength: 0 | |
}; | |
if (properties.aoColumns != null) { | |
if (properties.aoColumns.length < i || properties.aoColumns[i] == null) | |
return; | |
aoColumn = properties.aoColumns[i]; | |
} | |
//label = $(this).text(); //Before fix for ColVis | |
label = $($(this)[0].cell).text(); //Fix for ColVis | |
if (aoColumn.sSelector == null) { | |
//th = $($(this)[0]);//Before fix for ColVis | |
th = $($(this)[0].cell); //Fix for ColVis | |
} | |
else { | |
th = $(aoColumn.sSelector); | |
if (th.length == 0) | |
th = $($(this)[0].cell); | |
} | |
if (aoColumn != null) { | |
if (aoColumn.sRangeFormat != null) | |
sRangeFormat = aoColumn.sRangeFormat; | |
else | |
sRangeFormat = properties.sRangeFormat; | |
switch (aoColumn.type) { | |
case "null": | |
break; | |
case "number": | |
fnCreateInput(oTable, true, false, true, aoColumn.iFilterLength, aoColumn.iMaxLenght); | |
break; | |
case "select": | |
if (aoColumn.bRegex != true) | |
aoColumn.bRegex = false; | |
fnCreateSelect(oTable, aoColumn.values, aoColumn.bRegex, aoColumn.selected, aoColumn.multiple); | |
break; | |
case "number-range": | |
fnCreateRangeInput(oTable); | |
break; | |
case "date-range": | |
fnCreateDateRangeInput(oTable); | |
break; | |
case "checkbox": | |
fnCreateCheckbox(oTable, aoColumn.values); | |
break; | |
case "twitter-dropdown": | |
case "dropdown": | |
fnCreateDropdown(aoColumn.values); | |
break; | |
case "text": | |
default: | |
bRegex = (aoColumn.bRegex == null ? false : aoColumn.bRegex); | |
bSmart = (aoColumn.bSmart == null ? false : aoColumn.bSmart); | |
fnCreateInput(oTable, bRegex, bSmart, false, aoColumn.iFilterLength, aoColumn.iMaxLenght); | |
break; | |
} | |
} | |
}); | |
for (j = 0; j < aiCustomSearch_Indexes.length; j++) { | |
//var index = aiCustomSearch_Indexes[j]; | |
var fnSearch_ = function () { | |
var id = oTable.attr("id"); | |
return $("#" + id + "_range_from_" + aiCustomSearch_Indexes[j]).val() + properties.sRangeSeparator + $("#" + id + "_range_to_" + aiCustomSearch_Indexes[j]).val() | |
} | |
afnSearch_.push(fnSearch_); | |
} | |
if (oTable.fnSettings().oFeatures.bServerSide) { | |
var fnServerDataOriginal = oTable.fnSettings().fnServerData; | |
oTable.fnSettings().fnServerData = function (sSource, aoData, fnCallback) { | |
for (j = 0; j < aiCustomSearch_Indexes.length; j++) { | |
var index = aiCustomSearch_Indexes[j]; | |
for (k = 0; k < aoData.length; k++) { | |
if (aoData[k].name == "sSearch_" + index) | |
aoData[k].value = afnSearch_[j](); | |
} | |
} | |
aoData.push({ "name": "sRangeSeparator", "value": properties.sRangeSeparator }); | |
if (fnServerDataOriginal != null) { | |
try { | |
fnServerDataOriginal(sSource, aoData, fnCallback, oTable.fnSettings()); //TODO: See Issue 18 | |
} catch (ex) { | |
fnServerDataOriginal(sSource, aoData, fnCallback); | |
} | |
} | |
else { | |
$.getJSON(sSource, aoData, function (json) { | |
fnCallback(json) | |
}); | |
} | |
}; | |
} | |
}); | |
}; | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- http://jsfiddle.net/8svjf80g/1/ --> | |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>BC Data Catalogue Content</title> | |
<!-- <meta name="description" content=""> | |
<meta name="viewport" content="width=device-width"]\ | |
<link rel="shortcut icon" href="/favicon.ico"> --> | |
<!-- Place favicon.ico and apple-touch-icon.png in the root directory --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> | |
<!-- <link rel="stylesheet" href="http://cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/dataTables.bootstrap.css"> | |
--> | |
<!-- build:css(.tmp) styles/main.css --> | |
<!-- <link rel="stylesheet" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.css"> --> | |
<link rel='stylesheet' href="//cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/dataTables.bootstrap.js"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.0/bootstrap-table.min.css"> | |
<!-- Latest compiled and minified JavaScript --> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.0/bootstrap-table.min.js"></script> | |
<!-- <link rel="stylesheet" href="css/jasny-bootstrap.min.css"> --> | |
<script src="spin.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> | |
<style> | |
</style> | |
<body> | |
<div class="container"> | |
<div class="header"> | |
<ul class="nav nav-pills pull-right"> | |
</ul> | |
<!-- <h3 class="text-muted">BCDC API Demo Page</h3> --> | |
</div> | |
<div class="row marketing"> | |
<div class="col-lg-8"> | |
<h3>BC Data Catalogue Content</h3> | |
<p>Published Public Records</p> | |
</div> | |
</div> | |
<!-- <div class="input-group"> <span class="input-group-addon">Filter</span> | |
<input id="filter" type="text" class="form-control" placeholder="Type here..."> | |
</div> --> | |
<div class="row marketing"> | |
<div class="col-lg-8"> | |
<h4>All Public Records</h4> | |
<p>The table below is taken live from the BC Data Catalogue content. </p> | |
<select id="station"> | |
<option value="enterprise-data-services" selected>enterprise-data-services</option> | |
</select> | |
</div> | |
</div> | |
<div class="col-md-12"> | |
<table id="table" class="table table-striped" data-pagination="true" data-page-size="10" data-page-list="[10, 20, 50]" data-search="true"> | |
<thead> | |
<tr> | |
<th data-field="name" data-formatter="LinkFormatter">Title</th> | |
<th data-field="description">Description</th> | |
<th data-field="published">Date Published</th> | |
<th data-field="license">License</th> | |
</tr> | |
</thead> | |
<tbody class="searchable"> | |
<div id='spinner' class='spinner'></div> | |
</tbody> | |
</table> | |
</div> | |
<div class="footer"> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
var alldat,tab; | |
function LinkFormatter(value, row, index) { | |
return "<a href='https://catalogue.data.gov.bc.ca/dataset/"+row['id']+"'>"+value+"</a>"; | |
} | |
$(document).ready(function() { | |
$.ajax({ | |
url: 'https://catalogue.data.gov.bc.ca/api/3/action/organization_list', | |
success: function(data) { | |
// data: data.result | |
var parents = ["ministry-of-aboriginal-relations-and-reconciliation","ministry-of-advanced-education","ministry-of-agriculture","ministry-of-children-and-family-development","ministry-of-community-sport-and-cultural-development","ministry-of-education","ministry-of-energy-and-mines","ministry-of-environment","ministry-of-finance","ministry-of-forests-lands-and-natural-resource-operations","ministry-of-health","ministry-of-international-trade","ministry-of-jobs-tourism-and-skills-training","ministry-of-justice","ministry-of-natural-gas-development","ministry-of-social-development-and-social-innovation","ministry-of-technology-innovation-and-citizens-services","ministry-of-transportation-and-infrastructure","bc-agency","office-of-the-premier-and-cabinet-office","government-communications-and-public-engagement","government-of-canada","municipality","non-government","small-business-and-red-tape-reduction","worksafebc"] | |
var items = []; | |
var allOrgs = data.result; | |
// test=allOrgs | |
// console.log(allOrgs) | |
// plot_data(siteData); | |
$.each(allOrgs, function(key, value){ | |
if (parents.indexOf(value) == -1){ | |
items.push(value) | |
var option = $('<option />').text(value); | |
// console.log(option) | |
$("#station").append(option); | |
} | |
}); | |
} | |
}) | |
}); | |
$(document).ready(function() { | |
$('#station').on('change', function(data) { | |
station = $('#station').val(); | |
// console.log('//catalogue.data.gov.bc.ca/api/3/action/package_search?q=organization:"'+station+'"') | |
newdat=[] | |
url = 'https://catalogue.data.gov.bc.ca/api/3/action/package_search?q=organization:"'+station+'"&rows=1000'; | |
$.ajax({ | |
async: false, | |
url: url, | |
success: function(data) { | |
alldat = data.result.results | |
$.each(alldat, function(key, value){ | |
// console.log(value) | |
newdat.push({ | |
name:value['title'], | |
description:value['notes'], | |
published:value['record_publish_date'], | |
license:value['license_title'], | |
id:value['id'] | |
}) | |
// if (value == 'name'){ | |
// console.log(value['sector']) | |
// } | |
}) | |
// if (target) spinner.stop(); | |
} | |
}); | |
updatechart(newdat) | |
}); | |
}); | |
var smallDat = [] | |
var url = 'https://catalogue.data.gov.bc.ca/api/3/action/package_search?q=organization:"enterprise-data-services"&rows=1000' | |
$.ajax({ | |
async: false, | |
url: url, | |
success: function(data) { | |
alldat = data.result.results | |
// console.log(alldat) | |
$.each(alldat, function(key, value){ | |
// console.log(value) | |
smallDat.push({ | |
name:value['title'], | |
description:value['notes'], | |
published:value['record_publish_date'], | |
license:value['license_title'], | |
id:value['id'] | |
}) | |
// if (value == 'name'){ | |
// console.log(value['sector']) | |
// } | |
}) | |
// if (target) spinner.stop(); | |
} | |
}); | |
$(function () { | |
$('#table').bootstrapTable({ | |
data: smallDat | |
}); | |
}); | |
(function ($) { | |
$('#filter').keyup(function () { | |
var rex = new RegExp($(this).val(), 'i'); | |
$('.searchable tr').hide(); | |
$('.searchable tr').filter(function () { | |
return rex.test($(this).text()); | |
}).show(); | |
}) | |
}(jQuery)); | |
function updatechart(data){ | |
// console.log(newdat) | |
$('#table').bootstrapTable("load", newdat); | |
} | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) 2011-2014 Felix Gnass | |
* Licensed under the MIT license | |
* http://spin.js.org/ | |
* | |
* Example: | |
var opts = { | |
lines: 12 // The number of lines to draw | |
, length: 7 // The length of each line | |
, width: 5 // The line thickness | |
, radius: 10 // The radius of the inner circle | |
, scale: 1.0 // Scales overall size of the spinner | |
, corners: 1 // Roundness (0..1) | |
, color: '#000' // #rgb or #rrggbb | |
, opacity: 1/4 // Opacity of the lines | |
, rotate: 0 // Rotation offset | |
, direction: 1 // 1: clockwise, -1: counterclockwise | |
, speed: 1 // Rounds per second | |
, trail: 100 // Afterglow percentage | |
, fps: 20 // Frames per second when using setTimeout() | |
, zIndex: 2e9 // Use a high z-index by default | |
, className: 'spinner' // CSS class to assign to the element | |
, top: '50%' // center vertically | |
, left: '50%' // center horizontally | |
, shadow: false // Whether to render a shadow | |
, hwaccel: false // Whether to use hardware acceleration (might be buggy) | |
, position: 'absolute' // Element positioning | |
} | |
var target = document.getElementById('foo') | |
var spinner = new Spinner(opts).spin(target) | |
*/ | |
;(function (root, factory) { | |
/* CommonJS */ | |
if (typeof module == 'object' && module.exports) module.exports = factory() | |
/* AMD module */ | |
else if (typeof define == 'function' && define.amd) define(factory) | |
/* Browser global */ | |
else root.Spinner = factory() | |
}(this, function () { | |
"use strict" | |
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */ | |
, animations = {} /* Animation rules keyed by their name */ | |
, useCssAnimations /* Whether to use CSS animations or setTimeout */ | |
, sheet /* A stylesheet to hold the @keyframe or VML rules. */ | |
/** | |
* Utility function to create elements. If no tag name is given, | |
* a DIV is created. Optionally properties can be passed. | |
*/ | |
function createEl (tag, prop) { | |
var el = document.createElement(tag || 'div') | |
, n | |
for (n in prop) el[n] = prop[n] | |
return el | |
} | |
/** | |
* Appends children and returns the parent. | |
*/ | |
function ins (parent /* child1, child2, ...*/) { | |
for (var i = 1, n = arguments.length; i < n; i++) { | |
parent.appendChild(arguments[i]) | |
} | |
return parent | |
} | |
/** | |
* Creates an opacity keyframe animation rule and returns its name. | |
* Since most mobile Webkits have timing issues with animation-delay, | |
* we create separate rules for each line/segment. | |
*/ | |
function addAnimation (alpha, trail, i, lines) { | |
var name = ['opacity', trail, ~~(alpha * 100), i, lines].join('-') | |
, start = 0.01 + i/lines * 100 | |
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha) | |
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase() | |
, pre = prefix && '-' + prefix + '-' || '' | |
if (!animations[name]) { | |
sheet.insertRule( | |
'@' + pre + 'keyframes ' + name + '{' + | |
'0%{opacity:' + z + '}' + | |
start + '%{opacity:' + alpha + '}' + | |
(start+0.01) + '%{opacity:1}' + | |
(start+trail) % 100 + '%{opacity:' + alpha + '}' + | |
'100%{opacity:' + z + '}' + | |
'}', sheet.cssRules.length) | |
animations[name] = 1 | |
} | |
return name | |
} | |
/** | |
* Tries various vendor prefixes and returns the first supported property. | |
*/ | |
function vendor (el, prop) { | |
var s = el.style | |
, pp | |
, i | |
prop = prop.charAt(0).toUpperCase() + prop.slice(1) | |
if (s[prop] !== undefined) return prop | |
for (i = 0; i < prefixes.length; i++) { | |
pp = prefixes[i]+prop | |
if (s[pp] !== undefined) return pp | |
} | |
} | |
/** | |
* Sets multiple style properties at once. | |
*/ | |
function css (el, prop) { | |
for (var n in prop) { | |
el.style[vendor(el, n) || n] = prop[n] | |
} | |
return el | |
} | |
/** | |
* Fills in default values. | |
*/ | |
function merge (obj) { | |
for (var i = 1; i < arguments.length; i++) { | |
var def = arguments[i] | |
for (var n in def) { | |
if (obj[n] === undefined) obj[n] = def[n] | |
} | |
} | |
return obj | |
} | |
/** | |
* Returns the line color from the given string or array. | |
*/ | |
function getColor (color, idx) { | |
return typeof color == 'string' ? color : color[idx % color.length] | |
} | |
// Built-in defaults | |
var defaults = { | |
lines: 12 // The number of lines to draw | |
, length: 7 // The length of each line | |
, width: 5 // The line thickness | |
, radius: 10 // The radius of the inner circle | |
, scale: 1.0 // Scales overall size of the spinner | |
, corners: 1 // Roundness (0..1) | |
, color: '#000' // #rgb or #rrggbb | |
, opacity: 1/4 // Opacity of the lines | |
, rotate: 0 // Rotation offset | |
, direction: 1 // 1: clockwise, -1: counterclockwise | |
, speed: 1 // Rounds per second | |
, trail: 100 // Afterglow percentage | |
, fps: 20 // Frames per second when using setTimeout() | |
, zIndex: 2e9 // Use a high z-index by default | |
, className: 'spinner' // CSS class to assign to the element | |
, top: '50%' // center vertically | |
, left: '50%' // center horizontally | |
, shadow: false // Whether to render a shadow | |
, hwaccel: false // Whether to use hardware acceleration (might be buggy) | |
, position: 'absolute' // Element positioning | |
} | |
/** The constructor */ | |
function Spinner (o) { | |
this.opts = merge(o || {}, Spinner.defaults, defaults) | |
} | |
// Global defaults that override the built-ins: | |
Spinner.defaults = {} | |
merge(Spinner.prototype, { | |
/** | |
* Adds the spinner to the given target element. If this instance is already | |
* spinning, it is automatically removed from its previous target b calling | |
* stop() internally. | |
*/ | |
spin: function (target) { | |
this.stop() | |
var self = this | |
, o = self.opts | |
, el = self.el = createEl(null, {className: o.className}) | |
css(el, { | |
position: o.position | |
, width: 0 | |
, zIndex: o.zIndex | |
, left: o.left | |
, top: o.top | |
}) | |
if (target) { | |
target.insertBefore(el, target.firstChild || null) | |
} | |
el.setAttribute('role', 'progressbar') | |
self.lines(el, self.opts) | |
if (!useCssAnimations) { | |
// No CSS animation support, use setTimeout() instead | |
var i = 0 | |
, start = (o.lines - 1) * (1 - o.direction) / 2 | |
, alpha | |
, fps = o.fps | |
, f = fps / o.speed | |
, ostep = (1 - o.opacity) / (f * o.trail / 100) | |
, astep = f / o.lines | |
;(function anim () { | |
i++ | |
for (var j = 0; j < o.lines; j++) { | |
alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity) | |
self.opacity(el, j * o.direction + start, alpha, o) | |
} | |
self.timeout = self.el && setTimeout(anim, ~~(1000 / fps)) | |
})() | |
} | |
return self | |
} | |
/** | |
* Stops and removes the Spinner. | |
*/ | |
, stop: function () { | |
var el = this.el | |
if (el) { | |
clearTimeout(this.timeout) | |
if (el.parentNode) el.parentNode.removeChild(el) | |
this.el = undefined | |
} | |
return this | |
} | |
/** | |
* Internal method that draws the individual lines. Will be overwritten | |
* in VML fallback mode below. | |
*/ | |
, lines: function (el, o) { | |
var i = 0 | |
, start = (o.lines - 1) * (1 - o.direction) / 2 | |
, seg | |
function fill (color, shadow) { | |
return css(createEl(), { | |
position: 'absolute' | |
, width: o.scale * (o.length + o.width) + 'px' | |
, height: o.scale * o.width + 'px' | |
, background: color | |
, boxShadow: shadow | |
, transformOrigin: 'left' | |
, transform: 'rotate(' + ~~(360/o.lines*i + o.rotate) + 'deg) translate(' + o.scale*o.radius + 'px' + ',0)' | |
, borderRadius: (o.corners * o.scale * o.width >> 1) + 'px' | |
}) | |
} | |
for (; i < o.lines; i++) { | |
seg = css(createEl(), { | |
position: 'absolute' | |
, top: 1 + ~(o.scale * o.width / 2) + 'px' | |
, transform: o.hwaccel ? 'translate3d(0,0,0)' : '' | |
, opacity: o.opacity | |
, animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1 / o.speed + 's linear infinite' | |
}) | |
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px #000'), {top: '2px'})) | |
ins(el, ins(seg, fill(getColor(o.color, i), '0 0 1px rgba(0,0,0,.1)'))) | |
} | |
return el | |
} | |
/** | |
* Internal method that adjusts the opacity of a single line. | |
* Will be overwritten in VML fallback mode below. | |
*/ | |
, opacity: function (el, i, val) { | |
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val | |
} | |
}) | |
function initVML () { | |
/* Utility function to create a VML tag */ | |
function vml (tag, attr) { | |
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr) | |
} | |
// No CSS transforms but VML support, add a CSS rule for VML elements: | |
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)') | |
Spinner.prototype.lines = function (el, o) { | |
var r = o.scale * (o.length + o.width) | |
, s = o.scale * 2 * r | |
function grp () { | |
return css( | |
vml('group', { | |
coordsize: s + ' ' + s | |
, coordorigin: -r + ' ' + -r | |
}) | |
, { width: s, height: s } | |
) | |
} | |
var margin = -(o.width + o.length) * o.scale * 2 + 'px' | |
, g = css(grp(), {position: 'absolute', top: margin, left: margin}) | |
, i | |
function seg (i, dx, filter) { | |
ins( | |
g | |
, ins( | |
css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}) | |
, ins( | |
css( | |
vml('roundrect', {arcsize: o.corners}) | |
, { width: r | |
, height: o.scale * o.width | |
, left: o.scale * o.radius | |
, top: -o.scale * o.width >> 1 | |
, filter: filter | |
} | |
) | |
, vml('fill', {color: getColor(o.color, i), opacity: o.opacity}) | |
, vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change | |
) | |
) | |
) | |
} | |
if (o.shadow) | |
for (i = 1; i <= o.lines; i++) { | |
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)') | |
} | |
for (i = 1; i <= o.lines; i++) seg(i) | |
return ins(el, g) | |
} | |
Spinner.prototype.opacity = function (el, i, val, o) { | |
var c = el.firstChild | |
o = o.shadow && o.lines || 0 | |
if (c && i + o < c.childNodes.length) { | |
c = c.childNodes[i + o]; c = c && c.firstChild; c = c && c.firstChild | |
if (c) c.opacity = val | |
} | |
} | |
} | |
if (typeof document !== 'undefined') { | |
sheet = (function () { | |
var el = createEl('style', {type : 'text/css'}) | |
ins(document.getElementsByTagName('head')[0], el) | |
return el.sheet || el.styleSheet | |
}()) | |
var probe = css(createEl('group'), {behavior: 'url(#default#VML)'}) | |
if (!vendor(probe, 'transform') && probe.adj) initVML() | |
else useCssAnimations = vendor(probe, 'animation') | |
} | |
return Spinner | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment