"backgroundColor"nt"transition" --> "webkitTransition"n*/nnvar styleNameCache = {}; // We'll cache the style name conversionsnnexports.convertStyleNameToPropertyName = function(styleName) {nt// Return from the cache if we canntif(styleNameCache[styleName]) {nttreturn styleNameCache[styleName];nt}nt// Convert it by first removing any hyphensntvar propertyName = $tw.utils.unHyphenateCss(styleName);nt// Then check if it needs a prefixntif(document.body.style[propertyName] === undefined) {nttvar prefixes = ["O","MS","Moz","webkit"];nttfor(var t=0; t

"background-color"nt"webkitTransform" --> "-webkit-transform"n*/nexports.convertPropertyNameToStyleName = function(propertyName) {nt// Rehyphenate the namentvar styleName = $tw.utils.hyphenateCss(propertyName);nt// If there's a webkit prefix, add a dash (other browsers have uppercase prefixes, and so get the dash automatically)ntif(styleName.indexOf("webkit") === 0) {nttstyleName = "-" + styleName;nt} else if(styleName.indexOf("-m-s") === 0) {nttstyleName = "-ms" + styleName.substr(4);nt}ntreturn styleName;n};nn/*nRound trip a stylename to a property name and back again. For example:nt"transform" --> "webkitTransform" --> "-webkit-transform"n*/nexports.roundTripPropertyName = function(propertyName) {ntreturn $tw.utils.convertPropertyNameToStyleName($tw.utils.convertStyleNameToPropertyName(propertyName));n};nn/*nConverts a standard event name into the local browser specific equivalent. For example:nt"animationEnd" --> "webkitAnimationEnd"n*/nnvar eventNameCache = {}; // We'll cache the conversionsnnvar eventNameMappings = {nt"transitionEnd": {nttcorrespondingCssProperty: "transition",nttmappings: {nttttransition: "transitionend",ntttOTransition: "oTransitionEnd",ntttMSTransition: "msTransitionEnd",ntttMozTransition: "transitionend",ntttwebkitTransition: "webkitTransitionEnd"ntt}nt},nt"animationEnd": {nttcorrespondingCssProperty: "animation",nttmappings: {ntttanimation: "animationend",ntttOAnimation: "oAnimationEnd",ntttMSAnimation: "msAnimationEnd",ntttMozAnimation: "animationend",ntttwebkitAnimation: "webkitAnimationEnd"ntt}nt}n};nnexports.convertEventName = function(eventName) {ntif(eventNameCache[eventName]) {nttreturn eventNameCache[eventName];nt}ntvar newEventName = eventName,nttmappings = eventNameMappings[eventName];ntif(mappings) {nttvar convertedProperty = $tw.utils.convertStyleNameToPropertyName(mappings.correspondingCssProperty);nttif(mappings.mappings[convertedProperty]) {ntttnewEventName = mappings.mappings[convertedProperty];ntt}nt}nt// Put it in the cache toonteventNameCache[eventName] = newEventName;ntreturn newEventName;n};nn// Setup constants for the current browsernexports.getBrowserInfo = function(info) {ntinfo.isIE = (/msie|trident/i.test(navigator.userAgent));n};nn})();n", "title": "$:/core/modules/utils/dom/browser.js", "type": "application/javascript", "module-type": "utils" }, "$:/core/modules/utils/dom.js": { "text": "/*\ntitle: $:/core/modules/utils/dom.jsntype: application/javascriptnmodule-type: utilsnnVarious static DOM-related utility functions.nn\*/n(function(){nn/*jslint node: true, browser: true */n/*global $tw: false */n"use strict";nn/*nDetermines whether element 'a' contains element 'b'nCode thanks to John Resig, http://ejohn.org/blog/comparing-document-position/n*/nexports.domContains = function(a,b) {ntreturn a.contains ?ntta !== b && a.contains(b) :ntt!!(a.compareDocumentPosition(b) & 16);n};nnexports.removeChildren = function(node) {ntwhile(node.hasChildNodes()) {nttnode.removeChild(node.firstChild);nt}n};nnexports.hasClass = function(el,className) {ntreturn el && el.className && el.className.split(" ").indexOf(className) !== -1;n};nnexports.addClass = function(el,className) {ntvar c = el.className.split(" ");ntif(c.indexOf(className) === -1) {nttc.push(className);nt}ntel.className = c.join(" ");n};nnexports.removeClass = function(el,className) {ntvar c = el.className.split(" "),nttp = c.indexOf(className);ntif(p !== -1) {nttc.splice(p,1);nttel.className = c.join(" ");nt}n};nnexports.toggleClass = function(el,className,status) {ntif(status === undefined) {nttstatus = !exports.hasClass(el,className);nt}ntif(status) {nttexports.addClass(el,className);nt} else {nttexports.removeClass(el,className);nt}n};nnexports.applyStyleSheet = function(id,css) {ntvar el = document.getElementById(id);ntif(document.createStyleSheet) { // Older versions of IEnttif(el) {ntttel.parentNode.removeChild(el);ntt}nttdocument.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd",nttt' 
Skip to content Skip to footer
0 items - $0.00 0

TW5 Magick – Some tricks and snippets for TiddlyWiki 5 (2014) by Tomte

TW5 Magick – Some tricks and snippets for TiddlyWiki 5 (2014) by Tomte

Read More

Leave a comment

In the Shadows of Innovation”

© 2025 HackTech.info. All Rights Reserved.

Sign Up to Our Newsletter

Be the first to know the latest updates

Whoops, you're not connected to Mailchimp. You need to enter a valid Mailchimp API key.