From 76bec5cb2deeb7d9d2b4ad05237d82fa8cbb50a7 Mon Sep 17 00:00:00 2001 From: Maxime Vidori Date: Thu, 12 Jun 2014 15:23:20 +0200 Subject: [PATCH] Removal of jquery As long as we are using Angular and do not require any third part library, jQuery is not needed. This will reduce the footprint of storyboard and help us develop a cleaner web client. Change-Id: I95c0945bb39de9850e290d3303122a7c7df79da8 --- bower.json | 1 - src/app/services/provider/storyboard_api_base.js | 3 +-- src/app/util/directive/autoresize_width.js | 10 ++++++---- src/app/util/module.js | 12 +++++++++++- src/index.html | 1 - 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index 826faae3..02cb1a22 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,6 @@ "name": "storyboard-webclient", "version": "0.0.1", "dependencies": { - "jquery": "2.0.3", "font-awesome": "4.0", "angular": "1.2.13", "angular-resource": "1.2.13", diff --git a/src/app/services/provider/storyboard_api_base.js b/src/app/services/provider/storyboard_api_base.js index ef0d1f31..73511c1a 100644 --- a/src/app/services/provider/storyboard_api_base.js +++ b/src/app/services/provider/storyboard_api_base.js @@ -40,9 +40,8 @@ angular.module('sb.services') return; } } - // If there is a tag, then we can use that. - if ($('base').length > 0) { + if (document.getElementsByTagName('base').length > 0) { $provide.constant(propertyName, ''); return; } diff --git a/src/app/util/directive/autoresize_width.js b/src/app/util/directive/autoresize_width.js index e4c306de..8920800a 100644 --- a/src/app/util/directive/autoresize_width.js +++ b/src/app/util/directive/autoresize_width.js @@ -32,10 +32,12 @@ angular.module('sb.util') // Clone the created element and attach it to our DOM. var shadow = angular.element(''); shadow.attr('class', $element.attr('class')); - shadow.css('display', 'none') - .css('white-space', 'pre') - .css('width', 'auto') - .css('visibility', 'hidden'); + shadow.css({ + display: 'none', + 'white-space': 'pre', + width: 'auto', + visibility: 'hidden' + }); // Sane attach/detach $document.find('body').append(shadow); diff --git a/src/app/util/module.js b/src/app/util/module.js index 58f81878..40abfb9e 100644 --- a/src/app/util/module.js +++ b/src/app/util/module.js @@ -14,4 +14,14 @@ * under the License. */ -angular.module('sb.util', ['ui.router', 'LocalStorageModule']); \ No newline at end of file +angular.module('sb.util', ['ui.router', 'LocalStorageModule']) + .run(function () { + 'use strict'; + angular.element.prototype.hide = function () { + this.addClass('ng-hide'); + }; + + angular.element.prototype.show = function () { + this.removeClass('ng-hide'); + }; + }); \ No newline at end of file diff --git a/src/index.html b/src/index.html index c3aa029b..138c85b1 100644 --- a/src/index.html +++ b/src/index.html @@ -28,7 +28,6 @@ -