This file contains hidden or 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
| /** | |
| * Takes a CKEDITOR keyCode and returns a sanitized keyCode with any modifiers | |
| * removed i.e. CKEDITOR.CTRL, CKEDITOR.ALT, CKEDITOR.SHIFT | |
| * | |
| * @param keyCode {Number} CKEDITOR keyCode to check modifier on | |
| * @return {Number} Sanitized keyCode (minus the modifier keyCodes) | |
| **/ | |
| function sanitizeKeyCode(keyCode) { | |
| return Math.min(keyCode, | |
| Math.max(keyCode - CKEDITOR.CTRL, 0) || keyCode, |
This file contains hidden or 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
| // Add `valueAsNumber` support to `value` bindings etc | |
| ko.selectExtensions.readValue = _.wrap(ko.selectExtensions.readValue, function(read, element) { | |
| var result = read.apply(this, _.rest(arguments)); | |
| switch(ko.utils.tagNameLower(element)) { | |
| // For input-type `number` elements, check if it has a `valueAsNumber` property and if so, use it | |
| case 'input': | |
| if(element.type === 'number' && 'valueAsNumber' in element) { | |
| result = element.valueAsNumber; | |
| } |
This file contains hidden or 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
| /** | |
| AMD module, **to be included before the rest of your durandal app**, that enhances | |
| the native `router.parseQueryString` method, providing query parameters in their | |
| correct primitive type, rather than always as strings. | |
| @module Durandal.Router.Addons | |
| **/ | |
| define('plugins/router', function(router) { | |
| /** | |
| Parses a query string into an object, attempting to parse each query string param |
This file contains hidden or 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
| /** | |
| Enhanced `enable` binding that adds disabled attribute to .btn elements | |
| to support Bootstrap styling. | |
| NOTE: This also effects the `disable` binding handler, since it simply | |
| inverts the `enable` bindings logic internally. | |
| @static | |
| @class Enable | |
| @namespace Base.BindingHandlers |
This file contains hidden or 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 gulp = require('gulp'), | |
| watch = require('gulp-watch'), | |
| getImports = require('./lessImportList'); | |
| gulp.task('less', function(done) { | |
| getImports(['less/themes/default/app.less'], function(imports) { | |
| watch(imports) | |
| .pipe(/* Task logic here */) | |
| }); | |
| }); |
This file contains hidden or 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 gulp = require('gulp'); | |
| var watchLess = require('gulp-watch-less'); | |
| var less = require('gulp-less'); | |
| // LESS compilter configuration | |
| var lessConfig = { | |
| paths: ['../imports'] | |
| }; | |
| gulp.task('less', function () { |
This file contains hidden or 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 system = require('durandal/system'); | |
| var acquire = system.acquire; | |
| system.acquire = function(moduleIdOrModule) { | |
| var moduleType = typeof moduleIdOrModule; | |
| if(moduleType !== 'string') { | |
| return system.defer(function(dfd) { | |
| // If the moduleId is a funcction... | |
| if(moduleIdOrModule instanceof Function) { |
This file contains hidden or 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
| // Locates the view, realizes it, binds it to the parent binding context and composes it into the DOM node on which the binding is declared. | |
| data-bind="compose: 'myView.html'" | |
| // Uses RequireJS to get the shell module, locates the view conventionally, binds it and injects it into the DOM node on which the binding is declared. | |
| data-bind="compose: 'shell'" | |
| // Evaluates the binding to obtain the result of someProperty. If it is a string, assume it's a view, otherwise assume it's a viewmodel, and follow the steps above | |
| data-bind="compose: someProperty" |
This file contains hidden or 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
| define(id?: String, dependencies?: String[], factory: Function|Object); |
This file contains hidden or 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 system = require('durandal/system'); | |
| var acquire = system.acquire; | |
| system.acquire = function(moduleIdOrModule) { | |
| var moduleType = typeof moduleIdOrModule; | |
| if(moduleType !== 'string') { | |
| return system.defer(function(dfd) { | |
| // If the moduleId is a funcction... | |
| if(moduleIdOrModule instanceof Function) { |