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
| // Animates the dimensional changes resulting from altering element contents | |
| // Usage examples: | |
| // $("#myElement").showHtml("new HTML contents"); | |
| // $("div").showHtml("new HTML contents", 400); | |
| // $(".className").showHtml("new HTML contents", 400, | |
| // function() {/* on completion */}); | |
| (function($) | |
| { | |
| $.fn.showHtml = function(html, speed, callback) | |
| { |
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(['main/config'], function (config) { | |
| App.AccordionItemView = Ember.View.extend({ | |
| classNames: ['accordion-group'], | |
| parentId: null, | |
| parentRef: function() { | |
| var hasGroupControl = this.get('parentView.hasGroupControl'); | |
| return (hasGroupControl) ? "#" + this.get('parentId') : ""; | |
| }.property('parentId'), | |
| internalId: null, |
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
| uniqueId = function() { | |
| return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
| var r, v; | |
| r = Math.random() * 16 | 0; | |
| v = c === 'x' ? r : (r & 0x3 | 0x8); | |
| return v.toString(16); | |
| }); | |
| }; |
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
| /** | |
| A simple key value store that uses LocalStorage | |
| @class KeyValueStore | |
| @namespace Discourse | |
| @module Discourse | |
| **/ | |
| Discourse.KeyValueStore = { | |
| initialized: false, | |
| context: "", |
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
| emailValid: function(email) { | |
| // see: http://stackoverflow.com/questions/46155/validate-email-address-in-javascript | |
| var re; | |
| re = /^[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-zA-Z0-9!#$%&'\*+\/=?\^_`{|}~\-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/; | |
| return re.test(email); | |
| } |
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
| selectedText: function() { | |
| var html = ''; | |
| if (typeof window.getSelection !== "undefined") { | |
| var sel = window.getSelection(); | |
| if (sel.rangeCount) { | |
| var container = document.createElement("div"); | |
| for (var i = 0, len = sel.rangeCount; i < len; ++i) { | |
| container.appendChild(sel.getRangeAt(i).cloneContents()); | |
| } |