Browse Source

Merge pull request #109 from theurere/update-jquery-injectcss

Update jquery-injectcss
pull/102/head
Simon Eisenmann 12 years ago
parent
commit
3ec1c07716
  1. 2
      static/js/directives/audiovideo.js
  2. 14
      static/js/libs/jquery/jquery.injectCSS.js
  3. 8
      static/js/services/videolayout.js

2
static/js/directives/audiovideo.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
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) { return ["$window", "$compile", "$filter", "mediaStream", "safeApply", "desktopNotify", "buddyData", "videoWaiter", "videoLayout", "animationFrame", function($window, $compile, $filter, mediaStream, safeApply, desktopNotify, buddyData, videoWaiter, videoLayout, animationFrame) {

14
static/js/libs/jquery/jquery.injectCSS.js

@ -13,11 +13,11 @@
* Date: 2013-01-08 * Date: 2013-01-08
* Version: 0.1 * Version: 0.1
*/ */
// https://raw.githubusercontent.com/kajic/jquery-injectCSS/c85cea05dc10a893daa676c1ecaded34a4c59280/jquery.injectCSS.js
(function (jQuery) { (function (jQuery) {
'use strict'; 'use strict';
function toCSS(jss) { function toCSS(jss, options) {
function jsonToCSS(scope, css) { function jsonToCSS(scope, css) {
if (scope && !result[scope]) { if (scope && !result[scope]) {
result[scope] = {}; result[scope] = {};
@ -90,7 +90,7 @@
function addProperty(scope, property, value) { function addProperty(scope, property, value) {
if (typeof(value) === "number") { if (typeof(value) === "number" && !options.useRawValues) {
value = value + "px"; value = value + "px";
} }
@ -141,7 +141,9 @@
var defaults = { var defaults = {
truncateFirst: false, truncateFirst: false,
containerName: "injectCSSContainer" container: null,
containerName: "injectCSSContainer",
useRawValues: false
}; };
jQuery.injectCSS = function (jss, options) { jQuery.injectCSS = function (jss, options) {
@ -149,7 +151,7 @@
options.media = options.media || 'all'; options.media = options.media || 'all';
var container = jQuery("#" + options.containerName); var container = (options.container && jQuery(options.container)) || jQuery("#" + options.containerName);
if (!container.length) { if (!container.length) {
container = jQuery("<style></style>").appendTo('head').attr({ container = jQuery("<style></style>").appendTo('head').attr({
media: options.media, media: options.media,
@ -162,7 +164,7 @@
if (!options.truncateFirst) { if (!options.truncateFirst) {
css += container.text(); css += container.text();
} }
css += toCSS(jss); css += toCSS(jss, options);
var containerDomElem = container[0]; var containerDomElem = container[0];
if (containerDomElem.styleSheet !== undefined && containerDomElem.styleSheet.cssText !== undefined) { // IE if (containerDomElem.styleSheet !== undefined && containerDomElem.styleSheet.cssText !== undefined) { // IE

8
static/js/services/videolayout.js

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
define(["jquery", "underscore", "modernizr"], function($, _, Modernizr) { define(["jquery", "underscore", "modernizr", "injectCSS"], function($, _, Modernizr) {
var dynamicCSSContainer = "audiovideo-dynamic"; var dynamicCSSContainer = "audiovideo-dynamic";
var renderers = {}; var renderers = {};
@ -149,7 +149,8 @@ define(["jquery", "underscore", "modernizr"], function($, _, Modernizr) {
} }
$.injectCSS(extraCSS, { $.injectCSS(extraCSS, {
truncateFirst: true, truncateFirst: true,
containerName: dynamicCSSContainer containerName: dynamicCSSContainer,
useRawValues: true
}); });
}; };
@ -250,7 +251,8 @@ define(["jquery", "underscore", "modernizr"], function($, _, Modernizr) {
$.injectCSS(extraCSS, { $.injectCSS(extraCSS, {
truncateFirst: true, truncateFirst: true,
containerName: dynamicCSSContainer containerName: dynamicCSSContainer,
useRawValues: true
}); });
}; };

Loading…
Cancel
Save