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,
"sjcl": true,
"jQuery": true,
"$": true,
"_": true,
"oc_requesttoken": true
}

View File

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