From 200372adbfdc0958e6c5fb56db073c9e72163636 Mon Sep 17 00:00:00 2001 From: Evan Theurer Date: Wed, 3 Sep 2014 14:03:04 +0200 Subject: [PATCH] Update jquery-injectcss to c85cea05d. --- static/js/directives/audiovideo.js | 2 +- static/js/libs/jquery/jquery.injectCSS.js | 14 ++++++++------ static/js/services/videolayout.js | 8 +++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/static/js/directives/audiovideo.js b/static/js/directives/audiovideo.js index 60243c1d..f870d2cd 100644 --- a/static/js/directives/audiovideo.js +++ b/static/js/directives/audiovideo.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/audiovideopeer.html', 'bigscreen', 'injectCSS', 'webrtc.adapter'], function($, _, template, templatePeer, BigScreen) { +define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/audiovideopeer.html', 'bigscreen', 'webrtc.adapter'], function($, _, template, templatePeer, BigScreen) { return ["$window", "$compile", "$filter", "mediaStream", "safeApply", "desktopNotify", "buddyData", "videoWaiter", "videoLayout", "animationFrame", function($window, $compile, $filter, mediaStream, safeApply, desktopNotify, buddyData, videoWaiter, videoLayout, animationFrame) { diff --git a/static/js/libs/jquery/jquery.injectCSS.js b/static/js/libs/jquery/jquery.injectCSS.js index 92a59283..97644391 100644 --- a/static/js/libs/jquery/jquery.injectCSS.js +++ b/static/js/libs/jquery/jquery.injectCSS.js @@ -13,11 +13,11 @@ * Date: 2013-01-08 * Version: 0.1 */ - +// https://raw.githubusercontent.com/kajic/jquery-injectCSS/c85cea05dc10a893daa676c1ecaded34a4c59280/jquery.injectCSS.js (function (jQuery) { 'use strict'; - function toCSS(jss) { + function toCSS(jss, options) { function jsonToCSS(scope, css) { if (scope && !result[scope]) { result[scope] = {}; @@ -90,7 +90,7 @@ function addProperty(scope, property, value) { - if (typeof(value) === "number") { + if (typeof(value) === "number" && !options.useRawValues) { value = value + "px"; } @@ -141,7 +141,9 @@ var defaults = { truncateFirst: false, - containerName: "injectCSSContainer" + container: null, + containerName: "injectCSSContainer", + useRawValues: false }; jQuery.injectCSS = function (jss, options) { @@ -149,7 +151,7 @@ options.media = options.media || 'all'; - var container = jQuery("#" + options.containerName); + var container = (options.container && jQuery(options.container)) || jQuery("#" + options.containerName); if (!container.length) { container = jQuery("").appendTo('head').attr({ media: options.media, @@ -162,7 +164,7 @@ if (!options.truncateFirst) { css += container.text(); } - css += toCSS(jss); + css += toCSS(jss, options); var containerDomElem = container[0]; if (containerDomElem.styleSheet !== undefined && containerDomElem.styleSheet.cssText !== undefined) { // IE diff --git a/static/js/services/videolayout.js b/static/js/services/videolayout.js index b01452b5..f541c7c3 100644 --- a/static/js/services/videolayout.js +++ b/static/js/services/videolayout.js @@ -18,7 +18,7 @@ * along with this program. If not, see . * */ -define(["jquery", "underscore", "modernizr"], function($, _, Modernizr) { +define(["jquery", "underscore", "modernizr", "injectCSS"], function($, _, Modernizr) { var dynamicCSSContainer = "audiovideo-dynamic"; var renderers = {}; @@ -149,7 +149,8 @@ define(["jquery", "underscore", "modernizr"], function($, _, Modernizr) { } $.injectCSS(extraCSS, { truncateFirst: true, - containerName: dynamicCSSContainer + containerName: dynamicCSSContainer, + useRawValues: true }); }; @@ -250,7 +251,8 @@ define(["jquery", "underscore", "modernizr"], function($, _, Modernizr) { $.injectCSS(extraCSS, { truncateFirst: true, - containerName: dynamicCSSContainer + containerName: dynamicCSSContainer, + useRawValues: true }); };