Replace $ with jQuery

This commit is contained in:
brantje
2016-10-07 19:57:52 +02:00
parent 15b32b7e5e
commit 62f1fffebd
2 changed files with 33 additions and 34 deletions

View File

@ -42,7 +42,6 @@ module.exports = function (grunt) {
"forge": true, "forge": true,
"sjcl": true, "sjcl": true,
"jQuery": true, "jQuery": true,
"$": true,
"_": true, "_": true,
"oc_requesttoken": true "oc_requesttoken": true
} }

View File

@ -26,8 +26,8 @@
'ngTagsInput', 'ngTagsInput',
'angularjs-datetime-picker' 'angularjs-datetime-picker'
]) ])
.config(function ($routeProvider) { .config(function (jQueryrouteProvider) {
$routeProvider jQueryrouteProvider
.when('/', { .when('/', {
templateUrl: 'views/vaults.html', templateUrl: 'views/vaults.html',
controller: 'VaultCtrl' controller: 'VaultCtrl'
@ -57,8 +57,8 @@
.otherwise({ .otherwise({
redirectTo: '/' redirectTo: '/'
}); });
}).config(['$httpProvider', function ($httpProvider) { }).config(['jQueryhttpProvider', function (jQueryhttpProvider) {
$httpProvider.defaults.headers.common.requesttoken = oc_requesttoken; jQueryhttpProvider.defaults.headers.common.requesttoken = oc_requesttoken;
}]).config(function (localStorageServiceProvider) { }]).config(function (localStorageServiceProvider) {
localStorageServiceProvider localStorageServiceProvider
.setNotify(true, true); .setNotify(true, true);
@ -79,39 +79,39 @@
return foundItem; return foundItem;
}; };
jQuery(document).on('click', '.undoDelete', function () { jQuery(document).on('click', '.undoDelete', function () {
var credential = findItemByID($(this).attr('data-item-id')); var credential = findItemByID(jQuery(this).attr('data-item-id'));
angular.element('#app-content-wrapper').scope().recoverCredential(credential); angular.element('#app-content-wrapper').scope().recoverCredential(credential);
//Outside anglular we need $apply //Outside anglular we need jQueryapply
angular.element('#app-content-wrapper').scope().$apply(); angular.element('#app-content-wrapper').scope().jQueryapply();
}); });
jQuery(document).on('click', '.undoRestore', function () { jQuery(document).on('click', '.undoRestore', function () {
var credential = findItemByID($(this).attr('data-item-id')); var credential = findItemByID(jQuery(this).attr('data-item-id'));
angular.element('#app-content-wrapper').scope().deleteCredential(credential); angular.element('#app-content-wrapper').scope().deleteCredential(credential);
//Outside anglular we need $apply //Outside anglular we need jQueryapply
angular.element('#app-content-wrapper').scope().$apply(); angular.element('#app-content-wrapper').scope().jQueryapply();
}); });
var adjustControlsWidth = function (r) { var adjustControlsWidth = function (r) {
if ($('#controls').length) { if (jQuery('#controls').length) {
var controlsWidth; var controlsWidth;
// if there is a scrollbar … // if there is a scrollbar …
if ($('#app-content').get(0)) { if (jQuery('#app-content').get(0)) {
if ($('#app-content').get(0).scrollHeight > $('#app-content').height()) { if (jQuery('#app-content').get(0).scrollHeight > jQuery('#app-content').height()) {
if ($(window).width() > 768) { if (jQuery(window).width() > 768) {
controlsWidth = $('#content').width() - $('#app-navigation').width() - OC.Util.getScrollBarWidth(); controlsWidth = jQuery('#content').width() - jQuery('#app-navigation').width() - OC.Util.getScrollBarWidth();
if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) { if (!jQuery('#app-sidebar').hasClass('hidden') && !jQuery('#app-sidebar').hasClass('disappear')) {
controlsWidth -= $('#app-sidebar').width(); controlsWidth -= jQuery('#app-sidebar').width();
} }
} else { } else {
controlsWidth = $('#content').width() - OC.Util.getScrollBarWidth(); controlsWidth = jQuery('#content').width() - OC.Util.getScrollBarWidth();
} }
} else { // if there is none } else { // if there is none
if ($(window).width() > 768) { if (jQuery(window).width() > 768) {
controlsWidth = $('#content').width() - $('#app-navigation').width(); controlsWidth = jQuery('#content').width() - jQuery('#app-navigation').width();
if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) { if (!jQuery('#app-sidebar').hasClass('hidden') && !jQuery('#app-sidebar').hasClass('disappear')) {
//controlsWidth -= $('#app-sidebar').width(); //controlsWidth -= jQuery('#app-sidebar').width();
} }
} else { } else {
controlsWidth = $('#content').width(); controlsWidth = jQuery('#content').width();
} }
} }
} }
@ -121,25 +121,25 @@
} else { } else {
magic = 85; magic = 85;
} }
$('#controls').css('width', controlsWidth + magic); jQuery('#controls').css('width', controlsWidth + magic);
$('#controls').css('min-width', controlsWidth + magic); jQuery('#controls').css('min-width', controlsWidth + magic);
} }
}; };
$(window).resize(_.debounce(adjustControlsWidth, 400)); jQuery(window).resize(_.debounce(adjustControlsWidth, 400));
setTimeout(function () { setTimeout(function () {
adjustControlsWidth(true); adjustControlsWidth(true);
}, 200); }, 200);
//@Fack this //@Fack this
$(document).on('click', '#app-navigation-toggle', function () { jQuery(document).on('click', '#app-navigation-toggle', function () {
setTimeout(function () { setTimeout(function () {
if ($('#app-content').css('transform').toString().indexOf('matrix') >= 0) { if (jQuery('#app-content').css('transform').toString().indexOf('matrix') >= 0) {
$('#passman-controls').css('width', 'calc( 100% - 245px)'); jQuery('#passman-controls').css('width', 'calc( 100% - 245px)');
$('#passman-controls').css('top', '0'); jQuery('#passman-controls').css('top', '0');
} else { } else {
$('#passman-controls').css('left', 0); jQuery('#passman-controls').css('left', 0);
$('#passman-controls').css('top', '44px'); jQuery('#passman-controls').css('top', '44px');
$('#passman-controls').css('width', '100%'); jQuery('#passman-controls').css('width', '100%');
} }
}, 350); }, 350);
}); });