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 2013 Host Europe Group - All rights reserved. | |
// The 123-reg mobile site | |
if (!Object.keys) { | |
Object.keys = (function () { | |
'use strict'; | |
var hasOwnProperty = Object.prototype.hasOwnProperty, | |
hasDontEnumBug = !({ | |
toString: null | |
}).propertyIsEnumerable('toString'), | |
dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], |
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
(function ($) { | |
/** | |
* Override console in this scope so we can squash errors. | |
*/ | |
var con = window.console; | |
var console = { | |
log: function () { | |
con && con.log && con.log(Array.prototype.slice.call(arguments)); | |
}, |
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
$(document).on("click", ".edit_trigger", function () { | |
var $trigger = $(this); | |
// Find linked editable | |
var editableID = $trigger.data("editable"); | |
var $editable = $("#" + editableID); | |
// Replace editable with input. | |
var $input = $("<input>").val($editable.html().trim()); | |
$editable |
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
var A = function (props) { | |
this.properties = props; | |
this.constructor.addModel(this); | |
}; | |
A.models = []; | |
A.addModel = function (model) { | |
model.properties.id = this.models.length + 1; | |
this.models.push(model); |
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
var createPoller = function (pollFunc, interval) { | |
var timeout; | |
var poll = function () { | |
pollFunc(); | |
timeout = setTimeout(poll, interval); | |
}; | |
return { | |
start: function () { |
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
var createClass = function (methods, staticMethods) { | |
if (!methods || !methods.hasOwnProperty("init")) { | |
throw "you must include an init method"; | |
} | |
var newClass = function () { | |
this.init(); | |
}; | |
$.extend(newClass.prototype, methods); | |
$.extend(newClass, staticMethods); | |
return newClass; |
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
(function () { | |
var isObject = function (foo) { | |
return foo.constructor == Object; | |
}; | |
var mixin = function (a, b) { | |
for (var property in b) { | |
if (b.hasOwnProperty(property)) { | |
if (isObject(b[property])) { |
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
(withJQuery = function withJQuery() { | |
// Check for jQuery | |
if (!window.jQuery) { | |
return setTimeout(withJQuery, 100); | |
} | |
var getISODateFor = function (title) { | |
var selector = ".DtlDetailTbl td:contains('" + title + "') + .ResConfirmValue"; | |
var date = new Date($(selector).text()); | |
return date.toISOString(); |
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
var highest = 16777215; | |
var steps = 1000; | |
var step = highest / steps; | |
var emptyColor = "000000"; | |
for (var i=0; i < steps; i++) { | |
var color = parseInt(step * i, 10).toString(16); | |
color = emptyColor.slice(0, -color.length) + color; | |
var span = document.createElement("span"); | |
span.innerHTML = "a" |
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
//var formContainer = $("#ctl00_ContentPlaceHolder1_ffnpPayBrasPag1_dvBPCC"); | |
var findPrev = function (node, needle) { | |
var found = false; | |
do { | |
node = node.previousSibling; | |
var nv = node.nodeValue; | |
if (nv && nv.indexOf(needle) > -1) { | |
found = true; | |
} | |
} while (!found); |