calnedario iniciado

This commit is contained in:
2025-11-13 01:11:01 +01:00
commit 1212c82ea9
206 changed files with 172012 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+176
View File
@@ -0,0 +1,176 @@
/*
* Copyright (c) 2010 Nick Galbreath
* http://code.google.com/p/stringencoders/source/browse/#svn/trunk/javascript
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/* base64 encode/decode compatible with window.btoa/atob
*
* window.atob/btoa is a Firefox extension to convert binary data (the "b")
* to base64 (ascii, the "a").
*
* It is also found in Safari and Chrome. It is not available in IE.
*
* if (!window.btoa) window.btoa = base64.encode
* if (!window.atob) window.atob = base64.decode
*
* The original spec's for atob/btoa are a bit lacking
* https://developer.mozilla.org/en/DOM/window.atob
* https://developer.mozilla.org/en/DOM/window.btoa
*
* window.btoa and base64.encode takes a string where charCodeAt is [0,255]
* If any character is not [0,255], then an DOMException(5) is thrown.
*
* window.atob and base64.decode take a base64-encoded string
* If the input length is not a multiple of 4, or contains invalid characters
* then an DOMException(5) is thrown.
*/
var base64 = {};
base64.PADCHAR = '=';
base64.ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
base64.makeDOMException = function() {
// sadly in FF,Safari,Chrome you can't make a DOMException
var e, tmp;
try {
return new DOMException(DOMException.INVALID_CHARACTER_ERR);
} catch (tmp) {
// not available, just passback a duck-typed equiv
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Error/prototype
var ex = new Error("DOM Exception 5");
// ex.number and ex.description is IE-specific.
ex.code = ex.number = 5;
ex.name = ex.description = "INVALID_CHARACTER_ERR";
// Safari/Chrome output format
ex.toString = function() { return 'Error: ' + ex.name + ': ' + ex.message; };
return ex;
}
}
base64.getbyte64 = function(s,i) {
// This is oddly fast, except on Chrome/V8.
// Minimal or no improvement in performance by using a
// object with properties mapping chars to value (eg. 'A': 0)
var idx = base64.ALPHA.indexOf(s.charAt(i));
if (idx === -1) {
throw base64.makeDOMException();
}
return idx;
}
base64.decode = function(s) {
// convert to string
s = '' + s;
var getbyte64 = base64.getbyte64;
var pads, i, b10;
var imax = s.length
if (imax === 0) {
return s;
}
if (imax % 4 !== 0) {
throw base64.makeDOMException();
}
pads = 0
if (s.charAt(imax - 1) === base64.PADCHAR) {
pads = 1;
if (s.charAt(imax - 2) === base64.PADCHAR) {
pads = 2;
}
// either way, we want to ignore this last block
imax -= 4;
}
var x = [];
for (i = 0; i < imax; i += 4) {
b10 = (getbyte64(s,i) << 18) | (getbyte64(s,i+1) << 12) |
(getbyte64(s,i+2) << 6) | getbyte64(s,i+3);
x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 0xff, b10 & 0xff));
}
switch (pads) {
case 1:
b10 = (getbyte64(s,i) << 18) | (getbyte64(s,i+1) << 12) | (getbyte64(s,i+2) << 6);
x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 0xff));
break;
case 2:
b10 = (getbyte64(s,i) << 18) | (getbyte64(s,i+1) << 12);
x.push(String.fromCharCode(b10 >> 16));
break;
}
return x.join('');
}
base64.getbyte = function(s,i) {
var x = s.charCodeAt(i);
if (x > 255) {
throw base64.makeDOMException();
}
return x;
}
base64.encode = function(s) {
if (arguments.length !== 1) {
throw new SyntaxError("Not enough arguments");
}
var padchar = base64.PADCHAR;
var alpha = base64.ALPHA;
var getbyte = base64.getbyte;
var i, b10;
var x = [];
// convert to string
s = '' + s;
var imax = s.length - s.length % 3;
if (s.length === 0) {
return s;
}
for (i = 0; i < imax; i += 3) {
b10 = (getbyte(s,i) << 16) | (getbyte(s,i+1) << 8) | getbyte(s,i+2);
x.push(alpha.charAt(b10 >> 18));
x.push(alpha.charAt((b10 >> 12) & 0x3F));
x.push(alpha.charAt((b10 >> 6) & 0x3f));
x.push(alpha.charAt(b10 & 0x3f));
}
switch (s.length - imax) {
case 1:
b10 = getbyte(s,i) << 16;
x.push(alpha.charAt(b10 >> 18) + alpha.charAt((b10 >> 12) & 0x3F) +
padchar + padchar);
break;
case 2:
b10 = (getbyte(s,i) << 16) | (getbyte(s,i+1) << 8);
x.push(alpha.charAt(b10 >> 18) + alpha.charAt((b10 >> 12) & 0x3F) +
alpha.charAt((b10 >> 6) & 0x3f) + padchar);
break;
}
return x.join('');
}
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+258
View File
@@ -0,0 +1,258 @@
/*!
Autosize v1.18.0 - 2013-10-20
Automatically adjust textarea height based on user input.
(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
license: http://www.opensource.org/licenses/mit-license.php
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals: jQuery or jQuery-like library, such as Zepto
factory(window.jQuery || window.$);
}
}(function ($) {
var
defaults = {
className: 'autosizejs',
append: '',
callback: false,
resizeDelay: 10
},
// border:0 is unnecessary, but avoids a bug in FireFox on OSX
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
typographyStyles = [
'fontFamily',
'fontSize',
'fontWeight',
'fontStyle',
'letterSpacing',
'textTransform',
'wordSpacing',
'textIndent'
],
// to keep track which textarea is being mirrored when adjust() is called.
mirrored,
// the mirror element, which is used to calculate what size the mirrored element should be.
mirror = $(copy).data('autosize', true)[0];
// test that line-height can be accurately copied.
mirror.style.lineHeight = '99px';
if ($(mirror).css('lineHeight') === '99px') {
typographyStyles.push('lineHeight');
}
mirror.style.lineHeight = '';
$.fn.autosize = function (options) {
if (!this.length) {
return this;
}
options = $.extend({}, defaults, options || {});
if (mirror.parentNode !== document.body) {
$(document.body).append(mirror);
}
return this.each(function () {
var
ta = this,
$ta = $(ta),
maxHeight,
minHeight,
boxOffset = 0,
callback = $.isFunction(options.callback),
originalStyles = {
height: options.defaultStyles!=undefined && options.defaultStyles['height']!=undefined ? options.defaultStyles['height'] : ta.style.height,
overflow: options.defaultStyles!=undefined && options.defaultStyles['overflow']!=undefined ? options.defaultStyles['overflow'] : ta.style.overflow,
overflowY: options.defaultStyles!=undefined && options.defaultStyles['overflow-y']!=undefined ? options.defaultStyles['overflow-y'] : ta.style.overflowY,
wordWrap: options.defaultStyles!=undefined && options.defaultStyles['word-wrap']!=undefined ? options.defaultStyles['word-wrap'] : ta.style.wordWrap,
resize: options.defaultStyles!=undefined && options.defaultStyles['resize']!=undefined ? options.defaultStyles['resize'] : ta.style.resize
},
timeout,
width = $ta.width();
if ($ta.data('autosize')) {
// exit if autosize has already been applied, or if the textarea is the mirror element.
return;
}
$ta.data('autosize', true);
if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
boxOffset = $ta.outerHeight() - $ta.height();
}
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, originalStyles.height);
$ta.css({
overflow: 'hidden',
overflowY: 'hidden',
wordWrap: 'break-word', // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
resize: (originalStyles.resize === 'none' || originalStyles.resize === 'vertical') ? 'none' : 'horizontal'
});
// The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
function setWidth() {
var style, width;
if ('getComputedStyle' in window) {
style = window.getComputedStyle(ta, null);
width = ta.getBoundingClientRect().width;
$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
width -= parseInt(style[val],10);
});
mirror.style.width = width + 'px';
}
else {
// window.getComputedStyle, getBoundingClientRect returning a width are unsupported and unneeded in IE8 and lower.
mirror.style.width = Math.max($ta.width(), 0) + 'px';
}
}
function initMirror() {
var styles = {};
mirrored = ta;
mirror.className = options.className;
maxHeight = parseInt($ta.css('maxHeight'), 10);
// mirror is a duplicate textarea located off-screen that
// is automatically updated to contain the same text as the
// original textarea. mirror always has a height of 0.
// This gives a cross-browser supported way getting the actual
// height of the text, through the scrollTop property.
$.each(typographyStyles, function(i,val){
styles[val] = $ta.css(val);
});
$(mirror).css(styles);
setWidth();
// Chrome-specific fix:
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
if (window.chrome) {
var width = ta.style.width;
ta.style.width = '0px';
var ignore = ta.offsetWidth;
ta.style.width = width;
}
}
// Using mainly bare JS in this function because it is going
// to fire very often while typing, and needs to very efficient.
function adjust() {
var height, original;
if (mirrored !== ta) {
initMirror();
} else {
setWidth();
}
mirror.value = ta.value + options.append;
mirror.style.overflowY = ta.style.overflowY;
original = parseInt(ta.style.height,10);
// Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
mirror.scrollTop = 0;
mirror.scrollTop = 9e4;
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
height = mirror.scrollTop;
if (maxHeight && height > maxHeight) {
ta.style.overflowY = 'scroll';
height = maxHeight;
} else {
ta.style.overflowY = 'hidden';
if (height < minHeight) {
height = minHeight;
}
}
height += boxOffset;
if (original !== height) {
ta.style.height = height + 'px';
if (callback) {
options.callback.call(ta,ta);
}
}
}
function resize () {
clearTimeout(timeout);
timeout = setTimeout(function(){
var newWidth = $ta.width();
if (newWidth !== width) {
width = newWidth;
adjust();
}
}, parseInt(options.resizeDelay,10));
}
if ('onpropertychange' in ta) {
if ('oninput' in ta) {
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those occasions. There is no way that I
// know of to detect something like 'cut' in IE9.
$ta.on('input.autosize keyup.autosize', adjust);
} else {
// IE7 / IE8
$ta.on('propertychange.autosize', function(){
if(event.propertyName === 'value'){
adjust();
}
});
}
} else {
// Modern Browsers
$ta.on('input.autosize', adjust);
}
// Set options.resizeDelay to false if using fixed-width textarea elements.
// Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
if (options.resizeDelay !== false) {
$(window).on('resize.autosize', resize);
}
// Event for manual triggering if needed.
// Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
$ta.on('autosize.resize', adjust);
// Event for manual triggering that also forces the styles to update as well.
// Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
$ta.on('autosize.resizeIncludeStyle', function() {
mirrored = null;
adjust();
});
$ta.on('autosize.destroy', function(){
mirrored = null;
clearTimeout(timeout);
$(window).off('resize', resize);
$ta
.off('autosize')
.off('.autosize')
.css(originalStyles)
.removeData('autosize');
});
// Call adjust in case the textarea already contains text.
adjust();
});
};
}));
+43
View File
@@ -0,0 +1,43 @@
// jQuery.browser from 1.8.x
// Limit scope pollution from any deprecated API
(function() {
var matched, browser;
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
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"
};
};
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;
})();
@@ -0,0 +1,195 @@
/*****************************************************************************
jQuery Placeholder 1.1.9 (with minor modifications for CardDavMATE & CalDavZAP)
Copyright (c) 2010 Michael J. Ryan (http://tracker1.info/)
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
------------------------------------------------------------------------------
Sets up a watermark for inputted fields... this will create a LABEL.watermark
tag immediately following the input tag, the positioning will be set absolute,
and it will be positioned to match the input tag.
To activate:
$('input[placeholder],textarea[placeholder]').placeholder();
NOTE, when changing a value via script:
$('#input_id').val('new value').change(); //force change event, so placeholder sets properly
To style the tags as appropriate (you'll want to make sure the font matches):
label.placeholder {
cursor: text; <--- display a cursor to match the text input
padding: 4px 4px 4px 4px; <--- this should match the border+padding
for the input field(s)
color: #999999; <--- this will display as faded
}
You'll also want to have the color set for browsers with native support
input:placeholder, textarea:placeholder {
color: #999999;
}
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
color: #999999;
}
------------------------------------------------------------------------------
Thanks to...
http://www.alistapart.com/articles/makingcompactformsmoreaccessible
http://plugins.jquery.com/project/overlabel
This works similar to the overlabel, but creates the actual label tag
based on the placeholder attribute on the input tag, instead of
relying on the markup to provide it.
*****************************************************************************/
(function($){
var ph = "PLACEHOLDER-INPUT";
var phl = "PLACEHOLDER-LABEL";
var boundEvents = false;
var default_options = {
labelClass: 'placeholder'
};
//check for native support for placeholder attribute, if so stub methods and return
var input = document.createElement("input");
if ('placeholder' in input) {
$.fn.placeholder = $.fn.unplaceholder = function(){}; //empty function
delete input; //cleanup IE memory
return;
};
delete input;
//bind to resize to fix placeholders when the page resizes (fields are hidden/displayed, which can change positioning).
$(window).resize(checkResize);
$.fn.placeholder = function(options) {
bindEvents();
var opts = $.extend(default_options, options)
this.each(function(){
var rnd=Math.random().toString(32).replace(/\./,'')
,input=$(this)
,label=$('<label style="position:absolute;display:none;top:0;left:0;"></label>');
if (!input.attr('placeholder') || input.data(ph) === ph) return; //already watermarked
//make sure the input tag has an ID assigned, if not, assign one.
if (!input.attr('id')) input.attr('id', 'input_' + rnd);
label .attr('id',input.attr('id') + "_placeholder")
.data(ph, '#' + input.attr('id')) //reference to the input tag
.attr('for',input.attr('id'))
.addClass(opts.labelClass)
.addClass(opts.labelClass + '-for-' + this.tagName.toLowerCase()) //ex: watermark-for-textarea
.addClass(phl)
.text(input.attr('placeholder'));
input
.data(phl, '#' + label.attr('id')) //set a reference to the label
.data(ph,ph) //set that the field is watermarked
.addClass(ph) //add the watermark class
.after(label) //add the label field to the page
//setup overlay
itemFocus.call(this);
itemBlur.call(this);
});
};
$.fn.unplaceholder = function(){
this.each(function(){
var input=$(this),
label=$(input.data(phl));
if (input.data(ph) !== ph) return;
label.remove();
input.removeData(ph).removeData(phl).removeClass(ph).unbind('change',itemChange);
});
};
function bindEvents() {
if (boundEvents) return;
//prepare live bindings if not already done.
$(document).on('reset', 'form', function(){$(this).find('.'+ph).each(itemBlur);});
$(document).on('keydown mousedown mouseclick focus focusin', '.'+ph, itemFocus);
$(document).on('blur focusout', '.'+ph, itemBlur);
$(document).on('change', '.'+ph, itemChange);
$(document).on('click mouseup', '.'+phl, function(){$($(this).data(ph)).focus();});
bound = true;
boundEvents = true;
};
function itemChange() {
var input = $(this);
if (!!input.val()) {
$(input.data(phl)).hide();
return;
}
if (input.data(ph+'FOCUSED') != 1) {
showPHL(input);
}
}
function itemFocus() {
$($(this).data(ph+'FOCUSED',1).data(phl)).hide();
};
function itemBlur() {
var that = this;
showPHL($(this).removeData(ph+'FOCUSED'));
//use timeout to let other validators/formatters directly bound to blur/focusout work
setTimeout(function(){
var input = $(that);
//if the item wasn't refocused, test the item
if (input.data(ph+'FOCUSED') != 1) {
showPHL(input);
}
}, 200);
};
function showPHL(input, forced) {
var label = $(input.data(phl));
//if not already shown, and needs to be, show it.
if ((forced || label.css('display') == 'none') && !input.val())
label
.text(input.attr('placeholder'))
.css('top', input.position().top + 'px')
.css('left', input.position().left + 'px')
.css('display', 'block');
//console.dir({ 'input': { 'id':input.attr('id'), 'pos': input.position() }});
}
var cr;
function checkResize() {
if (cr) window.clearTimeout(cr);
cr = window.setTimeout(checkResize2, 50);
}
function checkResize2() {
$('.' + ph).each(function(){
var input = $(this);
var focused = $(this).data(ph+'FOCUSED');
if (!focused) showPHL(input, true);
});
}
}(jQuery));
+205
View File
@@ -0,0 +1,205 @@
(function($, window, document, undefined) {
$.fn.quicksearch = function (target, opt) {
var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({
delay: 100,
selector: null,
stripeRows: null,
loader: null,
noResults: '',
matchedResultsCount: 0,
bind: 'keyup',
onBefore: function () {
return;
},
onAfter: function () {
return;
},
show: function () {
this.style.display = "";
},
hide: function () {
this.style.display = "none";
},
prepareQuery: function (val) {
return val.toLowerCase().split(' ');
},
testQuery: function (query, txt, _row) {
for (var i = 0; i < query.length; i += 1) {
if (txt.indexOf(query[i]) === -1) {
return false;
}
}
return true;
}
}, opt);
this.go = function () {
var i = 0,
numMatchedRows = 0,
noresults = true,
query = options.prepareQuery(val),
val_empty = (val.replace(' ', '').length === 0);
for (var i = 0, len = rowcache.length; i < len; i++) {
if (val_empty || options.testQuery(query, cache[i], rowcache[i])) {
options.show.apply(rowcache[i]);
noresults = false;
numMatchedRows++;
} else {
options.hide.apply(rowcache[i]);
}
}
if (noresults) {
this.results(false);
} else {
this.results(true);
this.stripe();
}
this.matchedResultsCount = numMatchedRows;
this.loader(false);
options.onAfter();
return this;
};
/*
* External API so that users can perform search programatically.
* */
this.search = function (submittedVal) {
val = submittedVal;
e.trigger();
};
/*
* External API to get the number of matched results as seen in
* https://github.com/ruiz107/quicksearch/commit/f78dc440b42d95ce9caed1d087174dd4359982d6
* */
this.currentMatchedResults = function() {
return this.matchedResultsCount;
};
this.stripe = function () {
if (typeof options.stripeRows === "object" && options.stripeRows !== null)
{
var joined = options.stripeRows.join(' ');
var stripeRows_length = options.stripeRows.length;
jq_results.not(':hidden').each(function (i) {
$(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
});
}
return this;
};
this.strip = function (input) {
return $.trim(input.toLowerCase());
};
this.strip_html = function (input) {
var output = input.replace(new RegExp('<[^<]+\>', 'g'), "");
output = $.trim(output.toLowerCase());
return output;
};
this.results = function (bool) {
if (typeof options.noResults === "string" && options.noResults !== "") {
if (bool) {
$(options.noResults).hide();
} else {
$(options.noResults).show();
}
}
return this;
};
this.loader = function (bool) {
if (typeof options.loader === "string" && options.loader !== "") {
(bool) ? $(options.loader).show() : $(options.loader).hide();
}
return this;
};
this.cache = function () {
var type = $.type(target);
// Target is a string - selector for HTML elements
if(type==='string')
jq_results = $(target);
// Target is an array of objects
else if(type==='array') {
jq_results=target.slice();
}
// Target is an object containing ...
else if(type==='object') {
jq_results = [];
$.each(target, function(key, val){
// ... arrays of objects
if(val instanceof Array)
$.merge(jq_results,val);
// ... other objects
else
jq_results.push(val);
});
}
// if (typeof options.noResults==="string" && options.noResults!=="") {
// jq_results = jq_results.not(options.noResults);
// }
// var t = (typeof options.selector === "string") ? jq_results.find(options.selector) : $(target).not(options.noResults);
cache = $.map(jq_results, function (item) {
return (type==='string') ? e.strip_html(item.innerHTML) : (typeof item.searchvalue==='string') ? e.strip(item.searchvalue) : '';
});
rowcache = $.map(jq_results, function (item) {
return item;
});
/*
* Modified fix for sync-ing "val".
* Original fix https://github.com/michaellwest/quicksearch/commit/4ace4008d079298a01f97f885ba8fa956a9703d1
* */
val = val || this.val() || "";
return this.go();
};
this.trigger = function () {
this.loader(true);
options.onBefore();
window.clearTimeout(timeout);
timeout = window.setTimeout(function () {
e.go();
}, options.delay);
return this;
};
this.cache();
this.results(true);
this.stripe();
this.loader(false);
return this.each(function () {
/*
* Changed from .bind to .on.
* */
$(this).on(options.bind, function () {
val = $(this).val();
e.trigger();
});
});
};
}(jQuery, this, document));
+436
View File
@@ -0,0 +1,436 @@
/*
jQuery Tags Input Plugin 1.3.3 (with minor modifications for CardDavMATE)
Copyright (c) 2011 XOXCO, Inc
Documentation for this plugin lives here:
http://xoxco.com/clickable/jquery-tags-input
Licensed under the MIT license:
http://www.opensource.org/licenses/mit-license.php
ben@xoxco.com
*/
(function($){
var tags_settings=new Array();
var tags_callbacks=new Array();
String.prototype.escapeCustom=function(inputDelimiter)
{
var value=(this==undefined ? '' : this),
output='';
for(var i=0; i<value.length; i++)
{
if(value[i]==inputDelimiter || value[i]=='\\')
output+='\\';
output+=value[i];
}
return output;
}
// split and unescape values
String.prototype.splitCustom=function(inputDelimiter)
{
var outputArray=new Array(),
value=this,
j=0;
for(var i=0; i<value.length; i++)
{
if(value[i]==inputDelimiter)
{
if(outputArray[j]==undefined)
outputArray[j]='';
++j;
continue;
}
else if(value[i]=='\\')
++i;
outputArray[j]=(outputArray[j]==undefined ? '' : outputArray[j])+value[i];
}
return outputArray;
}
$.fn.doAutosize=function(o)
{
var minWidth=$(this).data('minwidth'),
maxWidth=$(this).data('maxwidth'),
val='',
input=$(this),
testSubject=$('#'+$(this).data('tester_id'));
if(val===(val=input.val()))
return;
// Enter new content into testSubject
var escaped=val.replace(/\s/g,'&nbsp;'); // get proper width for values with leading spaces (or only spaces)
testSubject.html(escaped);
// Calculate new width + whether to change
var testerWidth=testSubject.width(),
newWidth=(testerWidth+o.comfortZone)>=minWidth ? testerWidth+o.comfortZone : minWidth,
currentWidth=input.width(),
isValidWidthChange=(newWidth<currentWidth && newWidth>=minWidth) || (newWidth>minWidth && newWidth<maxWidth);
// Animate width
if(isValidWidthChange)
input.width(newWidth);
};
$.fn.resetAutosize=function(options)
{
// alert(JSON.stringify(options));
var minWidth=$(this).data('minwidth') || options.minInputWidth || $(this).width(),
maxWidth=$(this).data('maxwidth') || options.maxInputWidth || ($(this).closest('.tagsinput').width()-options.inputPadding),
val='',
input=$(this),
testSubject=$('<tester/>').css({
position: 'absolute',
top: -9999,
left: -9999,
width: 'auto',
fontSize: input.css('fontSize'),
fontFamily: input.css('fontFamily'),
fontWeight: input.css('fontWeight'),
letterSpacing: input.css('letterSpacing'),
whiteSpace: 'nowrap'
}),
testerId=$(this).attr('id')+'_autosize_tester';
if(!$('#'+testerId).length>0)
{
testSubject.attr('id', testerId);
testSubject.appendTo('body');
}
input.data('minwidth', minWidth);
input.data('maxwidth', maxWidth);
input.data('tester_id', testerId);
input.css('width', minWidth);
};
$.fn.addTag=function(value, options)
{
options=jQuery.extend({focus: false, callback: true, imported: false}, options);
this.each(function()
{
var id=$(this).attr('id');
if(tags_settings[id].allowDelimiterInValue==true)
var tagslist=$(this).val().splitCustom(tags_settings[id].delimiter);
else
var tagslist=$(this).val().split(delimiter[id]);
if(tagslist[0]=='')
tagslist=new Array();
if(options.trimInput==true)
value=jQuery.trim(value);
var skipTag=false;
var duplicate=$(tagslist).tagExist(value);
if(tags_callbacks[id] && tags_callbacks[id]['validateTag'])
skipTag=!tags_callbacks[id]['validateTag'].call(this, value, options.imported, duplicate);
if(!skipTag && options.unique)
skipTag=duplicate;
if(skipTag)
$(this).parent().find('#'+id+'_tag').addClass('not_valid'); //Marks fake input as not_valid to let styling it
if(value!='' && skipTag!=true)
{
$('<span>').addClass('tag').append(
$('<span>').text(value),
$('<a>', {
href: '#',
title: 'Removing tag',
text: 'x'
}).click(function(){return $('#'+id).removeTag(value)})
).insertBefore($(this).parent().find('#'+id+'_addTag'));
tagslist.push(value);
var tmpRef=$(this).parent().find('#'+id+'_tag');
tmpRef.val('');
if(options.focus)
tmpRef.focus();
else
tmpRef.blur();
$.fn.tagsInput.updateTagsField(this, tagslist);
if(options.callback && tags_callbacks[id] && tags_callbacks[id]['onAddTag'])
{
var f=tags_callbacks[id]['onAddTag'];
f.call(this, value);
}
if(tags_callbacks[id] && tags_callbacks[id]['onChange'])
{
var i=tagslist.length;
var f=tags_callbacks[id]['onChange'];
f.call(this, tagslist[i-1], options.imported);
}
}
});
return false;
};
$.fn.removeTag = function(value)
{
this.each(function()
{
var id=$(this).attr('id');
if(tags_settings[id].allowDelimiterInValue==true)
var old=$(this).val().splitCustom(tags_settings[id].delimiter);
else
var old=$(this).val().split(delimiter[id]);
$(this).parent().find('#'+id+'_tagsinput .tag').remove();
var str='';
for(i=0; i<old.length; i++)
if(old[i]!=value)
str=(str=='' ? '' : str+tags_settings[id].delimiter)+(tags_settings[id].allowDelimiterInValue==true ? old[i].escapeCustom(tags_settings[id].delimiter) : old[i]);
$.fn.tagsInput.importTags(this, str);
if(tags_callbacks[id] && tags_callbacks[id]['onRemoveTag'])
{
var f=tags_callbacks[id]['onRemoveTag'];
f.call(this, value);
}
});
return false;
};
$.fn.tagExist=function(val)
{
return (jQuery.inArray(val, $(this))>=0); //true when tag exists, false when not
};
// clear all existing tags and import new ones from a string
$.fn.importTags=function(str)
{
$(this).parent().find('#'+$(this).attr('id')+'_tagsinput .tag').remove();
$.fn.tagsInput.importTags(this, str);
}
$.fn.tagsInput=function(options)
{
var settings=jQuery.extend({
interactive: true,
defaultText: 'add a tag',
useNativePlaceholder:false,
minChars: 0,
width: '300px',
height: '100px',
autocomplete: {selectFirst: false},
hide: true,
delimiter: ',',
allowDelimiterInValue: false,
trimInput: true,
unique: true,
removeWithBackspace: true,
color: '#000000',
placeholderColor: '#666666',
autosize: true,
comfortZone: 20,
inputPadding: 6*2
}, options);
this.each(function()
{
if(settings.hide)
$(this).hide();
var id=$(this).attr('id');
var data=jQuery.extend({
real_inputObj: $(this),
pid: id,
real_input: '#'+id,
holder: '#'+id+'_tagsinput',
input_wrapper: '#'+id+'_addTag',
fake_input: '#'+id+'_tag'
}, settings);
tags_settings[id]={delimiter: data.delimiter, allowDelimiterInValue: data.allowDelimiterInValue};
if(settings.onAddTag || settings.onRemoveTag || settings.onChange || settings.validateTag)
{
tags_callbacks[id] = new Array();
tags_callbacks[id]['onAddTag'] = settings.onAddTag;
tags_callbacks[id]['onRemoveTag'] = settings.onRemoveTag;
tags_callbacks[id]['onChange'] = settings.onChange;
tags_callbacks[id]['validateTag'] = settings.validateTag;
}
var markup='<div id="'+id+'_tagsinput" class="tagsinput"><div id="'+id+'_addTag">';
if(settings.interactive)
markup=markup+'<div class="input_container"><input id="'+id+'_tag" type="text" value=""'+(settings.useNativePlaceholder==true ? ' placeholder="'+settings.defaultText+'" data-default=""' : ' data-default="'+settings.defaultText+'"')+' /></div>';
markup=markup+'</div><div class="tags_clear"></div></div>';
var tmpMarkupObj=$(markup).insertAfter(this);
if(settings.width!=null)
tmpMarkupObj.css('width', settings.width);
if(settings.height!=null)
tmpMarkupObj.css('height', settings.height);
if($(this).val()!='')
$.fn.tagsInput.importTags($(this), $(this).val());
if(settings.interactive)
{
tmpMarkupObj.val(tmpMarkupObj.attr('data-default'));
tmpMarkupObj.css('color', settings.placeholderColor);
tmpMarkupObj.resetAutosize(settings);
tmpMarkupObj.bind('click', data, function(event)
{
$(this).find(event.data.fake_input).focus();
});
tmpMarkupObj.find(data.fake_input).bind('focus', data, function(event)
{
if($(this).val() == $(this).attr('data-default'))
$(this).val('');
$(this).css('color', settings.color);
});
if(settings.autocomplete_url!=undefined)
{
var autocomplete_options={source: settings.autocomplete_url};
for(var attrname in settings.autocomplete)
autocomplete_options[attrname]=settings.autocomplete[attrname];
if(jQuery.Autocompleter!==undefined)
{
tmpMarkupObj.find(data.fake_input).autocomplete(settings.autocomplete_url, settings.autocomplete);
tmpMarkupObj.find(data.fake_input).bind('result', data, function(event, data, formatted)
{
if(data)
event.data.real_inputObj.addTag(data[0] + "", {focus: true, unique: settings.unique, trimInput: settings.trimInput});
});
}
else if(jQuery.ui.autocomplete!==undefined)
{
tmpMarkupObj.find(data.fake_input).autocomplete(autocomplete_options);
tmpMarkupObj.find(data.fake_input).bind('autocompleteselect', data, function(event,ui)
{
event.data.real_inputObj.addTag(ui.item.value, {focus: true, unique: settings.unique, trimInput: settings.trimInput});
return false;
});
}
// if a user tabs out of the field, create a new tag
// this is only available if autocomplete is not used.
tmpMarkupObj.find(data.fake_input).bind('blur', data, function(event)
{
var d=$(this).attr('data-default');
if($(this).val()!='' && $(this).val()!=d)
{
if((event.data.minChars<=$(this).val().length) && (!event.data.maxChars || (event.data.maxChars>=$(this).val().length)))
event.data.real_inputObj.addTag($(this).val(), {focus: true, unique: settings.unique, trimInput: settings.trimInput});
}
else
$(this).val($(this).attr('data-default'));
$(this).css('color', settings.placeholderColor);
return false;
});
}
// if user types a comma, create a new tag
tmpMarkupObj.find(data.fake_input).bind('keypress', data, function(event)
{
if(settings.allowDelimiterInValue==false && event.which==event.data.delimiter.charCodeAt(0) || event.which==13)
{
event.preventDefault();
if((event.data.minChars<=$(this).val().length) && (!event.data.maxChars || (event.data.maxChars>=$(this).val().length)))
event.data.real_inputObj.addTag($(event.data.fake_input).val(), {focus: true, unique: settings.unique, trimInput: settings.trimInput});
$(this).resetAutosize(settings);
return false;
}
else if(event.data.autosize)
$(this).doAutosize(settings);
});
//Delete last tag on backspace
data.removeWithBackspace && tmpMarkupObj.find(data.fake_input).bind('keydown', data, function(event)
{
if($(this).closest('.tagsinput').hasClass('readonly')==false && event.keyCode==8 && $(this).val()=='')
{
event.preventDefault();
var last_tag=$(this).closest('.tagsinput').find('.tag:last').text();
var id=$(this).attr('id').replace(/_tag$/, '');
last_tag=last_tag.replace(/x$/, '');
event.data.real_inputObj.removeTag(last_tag);
$(this).trigger('focus');
}
});
tmpMarkupObj.find(data.fake_input).blur();
//Removes the not_valid class when user changes the value of the fake input
if(data.unique)
{
tmpMarkupObj.find(data.fake_input).keydown(function(event)
{
if(event.keyCode==8 || String.fromCharCode(event.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/))
$(this).removeClass('not_valid');
});
}
} // if settings.interactive
// store settings
$(this).data('tagsOptions', settings);
return false;
});
return this;
};
$.fn.tagsInput.updateTagsField=function(obj, tagslist)
{
var id = $(obj).attr('id');
if(tags_settings[id].allowDelimiterInValue==true)
for(var i=0;i<tagslist.length;i++)
tagslist[i]=tagslist[i].escapeCustom(tags_settings[id].delimiter);
$(obj).val(tagslist.join(tags_settings[id].delimiter));
};
$.fn.tagsInput.importTags=function(obj, val)
{
var settings=jQuery.extend({
trimInput: true,
unique: true
}, $(obj).data('tagsOptions'));
$(obj).val('');
var id=$(obj).attr('id');
if(tags_settings[id].allowDelimiterInValue==true)
var tags=val.splitCustom(tags_settings[id].delimiter);
else
var tags=val.split(delimiter[id]);
for(var i=0; i<tags.length; i++)
$(obj).addTag(tags[i], {focus: true, unique: settings.unique, trimInput: settings.trimInput, callback: false, imported: true});
if(tags_callbacks[id] && tags_callbacks[id]['onChange'])
{
var f=tags_callbacks[id]['onChange'];
f.call(obj, tags[i], true);
}
};
})(jQuery);
+337
View File
@@ -0,0 +1,337 @@
/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
* in FIPS 180-2
* Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
* Also http://anmar.eu.org/projects/jssha2/
*/
/*
* Configurable variables. You may need to tweak these to be compatible with
* the server-side, but the defaults work in most cases.
*/
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
function hex_sha256(s) { return rstr2hex(rstr_sha256(str2rstr_utf8(s))); }
function b64_sha256(s) { return rstr2b64(rstr_sha256(str2rstr_utf8(s))); }
function any_sha256(s, e) { return rstr2any(rstr_sha256(str2rstr_utf8(s)), e); }
function hex_hmac_sha256(k, d)
{ return rstr2hex(rstr_hmac_sha256(str2rstr_utf8(k), str2rstr_utf8(d))); }
function b64_hmac_sha256(k, d)
{ return rstr2b64(rstr_hmac_sha256(str2rstr_utf8(k), str2rstr_utf8(d))); }
function any_hmac_sha256(k, d, e)
{ return rstr2any(rstr_hmac_sha256(str2rstr_utf8(k), str2rstr_utf8(d)), e); }
/*
* Perform a simple self-test to see if the VM is working
*/
function sha256_vm_test()
{
return hex_sha256("abc").toLowerCase() ==
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
}
/*
* Calculate the sha256 of a raw string
*/
function rstr_sha256(s)
{
return binb2rstr(binb_sha256(rstr2binb(s), s.length * 8));
}
/*
* Calculate the HMAC-sha256 of a key and some data (raw strings)
*/
function rstr_hmac_sha256(key, data)
{
var bkey = rstr2binb(key);
if(bkey.length > 16) bkey = binb_sha256(bkey, key.length * 8);
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = binb_sha256(ipad.concat(rstr2binb(data)), 512 + data.length * 8);
return binb2rstr(binb_sha256(opad.concat(hash), 512 + 256));
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex(input)
{
try { hexcase } catch(e) { hexcase=0; }
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var output = "";
var x;
for(var i = 0; i < input.length; i++)
{
x = input.charCodeAt(i);
output += hex_tab.charAt((x >>> 4) & 0x0F)
+ hex_tab.charAt( x & 0x0F);
}
return output;
}
/*
* Convert a raw string to a base-64 string
*/
function rstr2b64(input)
{
try { b64pad } catch(e) { b64pad=''; }
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var output = "";
var len = input.length;
for(var i = 0; i < len; i += 3)
{
var triplet = (input.charCodeAt(i) << 16)
| (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
| (i + 2 < len ? input.charCodeAt(i+2) : 0);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > input.length * 8) output += b64pad;
else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
}
}
return output;
}
/*
* Convert a raw string to an arbitrary string encoding
*/
function rstr2any(input, encoding)
{
var divisor = encoding.length;
var remainders = Array();
var i, q, x, quotient;
/* Convert to an array of 16-bit big-endian values, forming the dividend */
var dividend = Array(Math.ceil(input.length / 2));
for(i = 0; i < dividend.length; i++)
{
dividend[i] = (input.charCodeAt(i * 2) << 8) | input.charCodeAt(i * 2 + 1);
}
/*
* Repeatedly perform a long division. The binary array forms the dividend,
* the length of the encoding is the divisor. Once computed, the quotient
* forms the dividend for the next step. We stop when the dividend is zero.
* All remainders are stored for later use.
*/
while(dividend.length > 0)
{
quotient = Array();
x = 0;
for(i = 0; i < dividend.length; i++)
{
x = (x << 16) + dividend[i];
q = Math.floor(x / divisor);
x -= q * divisor;
if(quotient.length > 0 || q > 0)
quotient[quotient.length] = q;
}
remainders[remainders.length] = x;
dividend = quotient;
}
/* Convert the remainders to the output string */
var output = "";
for(i = remainders.length - 1; i >= 0; i--)
output += encoding.charAt(remainders[i]);
/* Append leading zero equivalents */
var full_length = Math.ceil(input.length * 8 /
(Math.log(encoding.length) / Math.log(2)))
for(i = output.length; i < full_length; i++)
output = encoding[0] + output;
return output;
}
/*
* Encode a string as utf-8.
* For efficiency, this assumes the input is valid utf-16.
*/
function str2rstr_utf8(input)
{
var output = "";
var i = -1;
var x, y;
while(++i < input.length)
{
/* Decode utf-16 surrogate pairs */
x = input.charCodeAt(i);
y = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
if(0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF)
{
x = 0x10000 + ((x & 0x03FF) << 10) + (y & 0x03FF);
i++;
}
/* Encode output as utf-8 */
if(x <= 0x7F)
output += String.fromCharCode(x);
else if(x <= 0x7FF)
output += String.fromCharCode(0xC0 | ((x >>> 6 ) & 0x1F),
0x80 | ( x & 0x3F));
else if(x <= 0xFFFF)
output += String.fromCharCode(0xE0 | ((x >>> 12) & 0x0F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
else if(x <= 0x1FFFFF)
output += String.fromCharCode(0xF0 | ((x >>> 18) & 0x07),
0x80 | ((x >>> 12) & 0x3F),
0x80 | ((x >>> 6 ) & 0x3F),
0x80 | ( x & 0x3F));
}
return output;
}
/*
* Encode a string as utf-16
*/
function str2rstr_utf16le(input)
{
var output = "";
for(var i = 0; i < input.length; i++)
output += String.fromCharCode( input.charCodeAt(i) & 0xFF,
(input.charCodeAt(i) >>> 8) & 0xFF);
return output;
}
function str2rstr_utf16be(input)
{
var output = "";
for(var i = 0; i < input.length; i++)
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF,
input.charCodeAt(i) & 0xFF);
return output;
}
/*
* Convert a raw string to an array of big-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binb(input)
{
var output = Array(input.length >> 2);
for(var i = 0; i < output.length; i++)
output[i] = 0;
for(var i = 0; i < input.length * 8; i += 8)
output[i>>5] |= (input.charCodeAt(i / 8) & 0xFF) << (24 - i % 32);
return output;
}
/*
* Convert an array of big-endian words to a string
*/
function binb2rstr(input)
{
var output = "";
for(var i = 0; i < input.length * 32; i += 8)
output += String.fromCharCode((input[i>>5] >>> (24 - i % 32)) & 0xFF);
return output;
}
/*
* Main sha256 function, with its support functions
*/
function sha256_S (X, n) {return ( X >>> n ) | (X << (32 - n));}
function sha256_R (X, n) {return ( X >>> n );}
function sha256_Ch(x, y, z) {return ((x & y) ^ ((~x) & z));}
function sha256_Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));}
function sha256_Sigma0256(x) {return (sha256_S(x, 2) ^ sha256_S(x, 13) ^ sha256_S(x, 22));}
function sha256_Sigma1256(x) {return (sha256_S(x, 6) ^ sha256_S(x, 11) ^ sha256_S(x, 25));}
function sha256_Gamma0256(x) {return (sha256_S(x, 7) ^ sha256_S(x, 18) ^ sha256_R(x, 3));}
function sha256_Gamma1256(x) {return (sha256_S(x, 17) ^ sha256_S(x, 19) ^ sha256_R(x, 10));}
function sha256_Sigma0512(x) {return (sha256_S(x, 28) ^ sha256_S(x, 34) ^ sha256_S(x, 39));}
function sha256_Sigma1512(x) {return (sha256_S(x, 14) ^ sha256_S(x, 18) ^ sha256_S(x, 41));}
function sha256_Gamma0512(x) {return (sha256_S(x, 1) ^ sha256_S(x, 8) ^ sha256_R(x, 7));}
function sha256_Gamma1512(x) {return (sha256_S(x, 19) ^ sha256_S(x, 61) ^ sha256_R(x, 6));}
var sha256_K = new Array
(
1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993,
-1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987,
1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522,
264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986,
-1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585,
113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,
1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885,
-1035236496, -949202525, -778901479, -694614492, -200395387, 275423344,
430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,
1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872,
-1866530822, -1538233109, -1090935817, -965641998
);
function binb_sha256(m, l)
{
var HASH = new Array(1779033703, -1150833019, 1013904242, -1521486534,
1359893119, -1694144372, 528734635, 1541459225);
var W = new Array(64);
var a, b, c, d, e, f, g, h;
var i, j, T1, T2;
/* append padding */
m[l >> 5] |= 0x80 << (24 - l % 32);
m[((l + 64 >> 9) << 4) + 15] = l;
for(i = 0; i < m.length; i += 16)
{
a = HASH[0];
b = HASH[1];
c = HASH[2];
d = HASH[3];
e = HASH[4];
f = HASH[5];
g = HASH[6];
h = HASH[7];
for(j = 0; j < 64; j++)
{
if (j < 16) W[j] = m[j + i];
else W[j] = safe_add(safe_add(safe_add(sha256_Gamma1256(W[j - 2]), W[j - 7]),
sha256_Gamma0256(W[j - 15])), W[j - 16]);
T1 = safe_add(safe_add(safe_add(safe_add(h, sha256_Sigma1256(e)), sha256_Ch(e, f, g)),
sha256_K[j]), W[j]);
T2 = safe_add(sha256_Sigma0256(a), sha256_Maj(a, b, c));
h = g;
g = f;
f = e;
e = safe_add(d, T1);
d = c;
c = b;
b = a;
a = safe_add(T1, T2);
}
HASH[0] = safe_add(a, HASH[0]);
HASH[1] = safe_add(b, HASH[1]);
HASH[2] = safe_add(c, HASH[2]);
HASH[3] = safe_add(d, HASH[3]);
HASH[4] = safe_add(e, HASH[4]);
HASH[5] = safe_add(f, HASH[5]);
HASH[6] = safe_add(g, HASH[6]);
HASH[7] = safe_add(h, HASH[7]);
}
return HASH;
}
function safe_add (x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff