Skip to content

Instantly share code, notes, and snippets.

(function() {
"use strict";
// Reduce version of jQuery (1.6.4) is loaded at this point in the JSVM.
var _$,
$form,
VERSION = '24',
timer,
$selectRegion = $('select[name="region"]'),
dataFilterHandler = function(data, dataType) {
@nkmdk-007
nkmdk-007 / renderItem
Created March 18, 2014 14:07
renderItem(template, object) - A little method to switch out fields in a template from an object
function renderItem(param_renItem, item) {
var renItem = param_renItem;
var tp = renItem.match(/{{[\d\w]*}}/g);
var indx;
var reg;
for (indx = 0; indx < tp.length; indx++) {
var p = tp[indx].replace(/[{}]/g, '');
reg = new RegExp(tp[indx], "g");
if (item.hasOwnProperty(p)) {
@nkmdk-007
nkmdk-007 / content.js
Created March 13, 2014 16:16
Popped up during Chrome debugging, this seems to be the WebDeveloper Extension
var WebDeveloper = WebDeveloper || {};
WebDeveloper.Common = WebDeveloper.Common || {};
WebDeveloper.Common.requestTimeout = 10000;
// Adds a class to an element
WebDeveloper.Common.addClass = function(element, className)
{
// If the element and class name are set and the element does not already have this class
if(element && className && !WebDeveloper.Common.hasClass(element, className))
@nkmdk-007
nkmdk-007 / content.js
Created March 13, 2014 16:16
popped up during chrome debugging
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name content.js
// @externs_url http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/chrome_extensions.js
// @js_externs var console = {assert: function(){}};
// @formatting pretty_print
// ==/ClosureCompiler==
/** @license
JSON Formatter | MIT License
@nkmdk-007
nkmdk-007 / createOutline.js
Created March 13, 2014 16:13
This one popped up in the Chrome debugger, saving and referring to these is a good way to learn how vendors implement their JS code and we can learn from any patterns used.
/**
* This code contains an implementation of HTML5 outlining algorithm, as described by WHATWG at [1]
*
* The copyright notice at [2] says:
* (c) Copyright 2004-2009 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA.
* You are granted a license to use, reproduce and create derivative works of this document.
*
* [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#outlines
* [2] http://www.whatwg.org/specs/web-apps/current-work/multipage/index.html
*/