Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions core/js/dist/login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/login.js.map

Large diffs are not rendered by default.

112 changes: 66 additions & 46 deletions core/js/dist/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/main.js.map

Large diffs are not rendered by default.

458 changes: 0 additions & 458 deletions core/js/js.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions core/js/tests/specs/coreSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,11 @@ describe('Core base tests', function() {
describe('Session heartbeat', function() {
var clock,
oldConfig,
routeStub,
counter;

beforeEach(function() {
clock = sinon.useFakeTimers();
oldConfig = OC.config;
routeStub = sinon.stub(OC, 'generateUrl').returns('/csrftoken');
counter = 0;

fakeServer.autoRespond = true;
Expand All @@ -389,7 +387,6 @@ describe('Core base tests', function() {
clock.restore();
/* jshint camelcase: false */
OC.config = oldConfig;
routeStub.restore();
$(document).off('ajaxError');
$(document).off('ajaxComplete');
});
Expand All @@ -400,7 +397,6 @@ describe('Core base tests', function() {
session_lifetime: 300
};
window.initCore();
expect(routeStub.calledWith('/csrftoken')).toEqual(true);

expect(counter).toEqual(0);

Expand All @@ -427,7 +423,6 @@ describe('Core base tests', function() {
session_lifetime: 300
};
window.initCore();
expect(routeStub.notCalled).toEqual(true);

expect(counter).toEqual(0);

Expand Down
4 changes: 1 addition & 3 deletions core/src/OC/appconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const appConfig = window.oc_appconfig || {}
* @namespace
* @deprecated 16.0.0 Use OCP.AppConfig instead
*/
const AppConfig = {
export const AppConfig = {
/**
* @deprecated Use OCP.AppConfig.getValue() instead
*/
Expand Down Expand Up @@ -69,5 +69,3 @@ const AppConfig = {
}

};

export default AppConfig;
34 changes: 34 additions & 0 deletions core/src/components/ContactsMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* @copyright 2019 Christoph Wurst <[email protected]>
*
* @author 2019 Christoph Wurst <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import $ from 'jquery'

import OC from '../OC'

/**
* @todo move to contacts menu code https://github.com/orgs/nextcloud/projects/31#card-21213129
*/
export const setUp = () => {
new OC.ContactsMenu({
el: $('#contactsmenu .menu'),
trigger: $('#contactsmenu .menutoggle')
})
}
93 changes: 93 additions & 0 deletions core/src/components/MainMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* @copyright 2019 Christoph Wurst <[email protected]>
*
* @author 2019 Christoph Wurst <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import $ from 'jquery'

import OC from '../OC'

/**
* Set up the main menu toggle to react to media query changes.
* If the screen is small enough, the main menu becomes a toggle.
* If the screen is bigger, the main menu is not a toggle any more.
*/
export const setUp = () => {
// init the more-apps menu
OC.registerMenu($('#more-apps > a'), $('#navigation'))

// toggle the navigation
const $toggle = $('#header .header-appname-container')
const $navigation = $('#navigation')
const $appmenu = $('#appmenu')

// init the menu
OC.registerMenu($toggle, $navigation)
$toggle.data('oldhref', $toggle.attr('href'))
$toggle.attr('href', '#')
$navigation.hide()

// show loading feedback on more apps list
$navigation.delegate('a', 'click', event => {
let $app = $(event.target)
if (!$app.is('a')) {
$app = $app.closest('a')
}
if (event.which === 1 && !event.ctrlKey && !event.metaKey) {
$app.find('svg').remove()
$app.find('div').remove() // prevent odd double-clicks
// no need for theming, loader is already inverted on dark mode
// but we need it over the primary colour
$app.prepend($('<div/>').addClass('icon-loading-small'))
} else {
// Close navigation when opening app in
// a new tab
OC.hideMenus(() => false)
}
})

$navigation.delegate('a', 'mouseup', event => {
if (event.which === 2) {
// Close navigation when opening app in
// a new tab via middle click
OC.hideMenus(() => false)
}
})

// show loading feedback on visible apps list
$appmenu.delegate('li:not(#more-apps) > a', 'click', event => {
let $app = $(event.target)
if (!$app.is('a')) {
$app = $app.closest('a')
}
if (event.which === 1 && !event.ctrlKey && !event.metaKey && $app.parent('#more-apps').length === 0) {
$app.find('svg').remove()
$app.find('div').remove() // prevent odd double-clicks
$app.prepend($('<div/>').addClass(
OCA.Theming && OCA.Theming.inverted
? 'icon-loading-small'
: 'icon-loading-small-dark'
))
} else {
// Close navigation when opening app in
// a new tab
OC.hideMenus(() => false)
}
})
}
53 changes: 53 additions & 0 deletions core/src/components/UserMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* @copyright 2019 Christoph Wurst <[email protected]>
*
* @author 2019 Christoph Wurst <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import OC from '../OC'

import $ from 'jquery'

export const setUp = () => {
const $menu = $('#header #settings')

// show loading feedback
$menu.delegate('a', 'click', event => {
let $page = $(event.target)
if (!$page.is('a')) {
$page = $page.closest('a')
}
if (event.which === 1 && !event.ctrlKey && !event.metaKey) {
$page.find('img').remove()
$page.find('div').remove() // prevent odd double-clicks
$page.prepend($('<div/>').addClass('icon-loading-small'))
} else {
// Close navigation when opening menu entry in
// a new tab
OC.hideMenus(() => false)
}
})

$menu.delegate('a', 'mouseup', event => {
if (event.which === 2) {
// Close navigation when opening app in
// a new tab via middle click
OC.hideMenus(() => false)
}
})
}
3 changes: 2 additions & 1 deletion core/src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import appswebroots from "./OC/appswebroots";
import {initCore} from './init'

const warnIfNotTesting = function() {
if (window.TESTING === undefined) {
Expand Down Expand Up @@ -115,6 +115,7 @@ window['md5'] = md5
window['moment'] = moment

window['OC'] = OC
setDeprecatedProp('initCore', initCore, 'this is an internal function')
setDeprecatedProp('oc_appswebroots', OC.appswebroots, 'use OC.appswebroots instead')
setDeprecatedProp('oc_config', OC.config, 'use OC.config instead')
setDeprecatedProp('oc_current_user', OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead')
Expand Down
Loading