Skip to content

Commit a8192f5

Browse files
committed
Remove jQuery.
- Replace jQuery slider with html5 slider. - Add css for html5 slider. - Add bootstrap configs excluding any script.
1 parent 8f0346c commit a8192f5

21 files changed

+156
-120
lines changed

app/components/sidebar/groups/endpoint-group/endpoint-group.drv.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import endpointGroupTemplate from './endpoint-group.html';
2-
31
/**
42
* @ngdoc directive
53
* @name endpointGroup
@@ -22,7 +20,7 @@ const endpointGroup = function() {
2220
},
2321
controller: 'EndpointGroupCtrl',
2422
controllerAs: 'vm',
25-
template: endpointGroupTemplate
23+
template: require('./endpoint-group.html')
2624
};
2725

2826
};

app/components/sidebar/groups/graph-settings-group/graph-settings-group.ctrl.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,20 @@ function graphSettingsCtrl($rootScope, $log, Prefixes, Links) {
2323

2424
graphSettings.layoutPaused = false;
2525

26-
graphSettings.setClassToClassEdgeLength = function (newValue) {
27-
if (newValue === undefined) {
28-
$log.error('[Graph Settings] New class to class edge length is undefined!');
29-
return;
30-
}
31-
graphSettings.ccEdgeLength = newValue;
32-
Links.setClassToClassDistance(newValue);
26+
graphSettings.updateClassToClassLength = function() {
27+
const newLength = parseInt(graphSettings.ccEdgeLength);
28+
Links.setClassToClassDistance(newLength);
3329

3430
// node link graph must be informed
35-
$rootScope.$broadcast('edge-length-changed', newValue);
31+
$rootScope.$broadcast('edge-length-changed', newLength);
3632
};
3733

38-
graphSettings.setClassToDatatypeEdgeLength = function (newValue) {
39-
if (newValue === undefined) {
40-
$log.error('[Graph Settings] New class to data type edge length is undefined!');
41-
return;
42-
}
43-
graphSettings.ctEdgeLength = newValue;
44-
Links.setClassToDatatypeDistance(newValue);
34+
graphSettings.updateClassToDatatypeLength = function() {
35+
const newLength = parseInt(graphSettings.ctEdgeLength)
36+
Links.setClassToDatatypeDistance(newLength);
4537

4638
// node link graph must be informed
47-
$rootScope.$broadcast('edge-length-changed', newValue);
39+
$rootScope.$broadcast('edge-length-changed', newLength);
4840
};
4941

5042
/**

app/components/sidebar/groups/graph-settings-group/graph-settings-group.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@
1212

1313
<p>
1414
<label for="ccEdgeLength">Class - Class Distance: {{ graphSettings.ccEdgeLength }}</label>
15-
<div id="ccEdgeLength" slider class="cdbl-slider" model="graphSettings.ccEdgeLength" min="1" max="300"
16-
on-update="graphSettings.setClassToClassEdgeLength(newValue)">
17-
</div>
15+
<input id="ccEdgeLength" type="range" min="1" max="300" ng-model="graphSettings.ccEdgeLength" ng-change="graphSettings.updateClassToClassLength()" />
1816
</p>
1917

2018
<p>
2119
<label for="ctEdgeLength">Class - Type Distance: {{ graphSettings.ctEdgeLength }}</label>
22-
<div id="ctEdgeLength" slider class="cdbl-slider" model="graphSettings.ctEdgeLength" min="1" max="150"
23-
on-update="graphSettings.setClassToDatatypeEdgeLength(newValue)">
24-
</div>
20+
<input id="ctEdgeLength" type="range" min="1" max="150" ng-model="graphSettings.ctEdgeLength" ng-change="graphSettings.updateClassToDatatypeLength()" />
2521
</p>
2622

2723
<p><strong>Layout</strong></p>

app/components/sidebar/groups/graph-settings-group/graph-settings-group.module.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import angular from 'angular';
33
import GraphSettingsGroupCtrl from './graph-settings-group.ctrl';
44
import graphSettingsGroup from './graph-settings-group.drv';
55

6+
require('./graph-settings.css');
7+
68
/**
79
* @ngdoc module
810
* @name sidebar.groups.graphsettings
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
input[type=range] {
2+
-webkit-appearance: none;
3+
width: 100%;
4+
background: transparent;
5+
}
6+
7+
input[type=range]::-webkit-slider-thumb {
8+
-webkit-appearance: none;
9+
height: 1.4em;
10+
width: 1.4em;
11+
border: 1px solid #d3d3d3;
12+
border-radius: 4px;
13+
background: #f5f5f5;
14+
margin-top: -0.4em;
15+
}
16+
17+
input[type=range]::-webkit-slider-thumb:hover {
18+
border: 1px solid #999;
19+
}
20+
21+
input[type=range]::-webkit-slider-runnable-track{
22+
width: 100%;
23+
height: 0.8em;
24+
border: 1px solid #aaa;
25+
border-radius: 4px;
26+
margin: 10px 0 10px 0;
27+
}
28+
29+
input[type=range]:focus {
30+
outline: none;
31+
}
32+
33+
input[type=range]::-ms-track {
34+
width: 100%;
35+
cursor: pointer;
36+
background: transparent;
37+
border-color: transparent;
38+
color: transparent;
39+
}
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import angular from 'angular';
22

3-
import Slider from './slider.drv.js';
4-
53
import groups from './groups/sidebar-groups.module';
64
import selections from './selection/selection.module';
75

@@ -12,7 +10,6 @@ import selections from './selection/selection.module';
1210
* @requires groups, selections
1311
*
1412
* @description
15-
* This is the module for the sidebar of the application, including the directive for the jQuery slider.
13+
* This is the module for the sidebar of the application.
1614
*/
17-
export default angular.module('components.sidebar', [groups.name, selections.name])
18-
.directive('slider', Slider);
15+
export default angular.module('components.sidebar', [groups.name, selections.name]);

app/components/sidebar/slider.drv.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

app/core/bootstrap.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ require('./vendor.js')(); // run an empty function
55

66
require('../styles/main.css');
77
require('../styles/graph.css');
8-
require('../../node_modules/jquery-ui/themes/base/jquery-ui.css');
98

109
import appModule from '../app';
1110

app/core/vendor.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ module.exports = function () {
55
require('angular-route');
66
require('angular-animate');
77
require('angular-cookies');
8-
require('jquery');
9-
require('jquery-ui');
10-
require('bootstrap-webpack');
8+
require('bootstrap-webpack!../../bootstrap.config.js');
119
require('angular-ui-bootstrap');
1210

1311
};

app/services/endpoints.srv.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,29 @@
88
*/
99
function endpoints($http) {
1010

11-
const NON_PROXY_ENDPOINTS_FILE_NAME = 'nonproxy_endpoints.json';
12-
const PROXY_ENDPOINTS_FILE_NAME = 'proxy_endpoints.json';
11+
const NON_PROXY_ENDPOINTS_FILE_NAME = require('../nonproxy_endpoints.json');
12+
const PROXY_ENDPOINTS_FILE_NAME = require('../proxy_endpoints.json');
1313

1414
const that = this;
1515

1616
that.getNonProxyEndpoints = function () {
17-
return $http.get(NON_PROXY_ENDPOINTS_FILE_NAME);
17+
let url;
18+
if (typeof NON_PROXY_ENDPOINTS_FILE_NAME !== 'string') {
19+
url = 'nonproxy_endpoints.json';
20+
} else {
21+
url = NON_PROXY_ENDPOINTS_FILE_NAME;
22+
}
23+
return $http.get(url);
1824
};
1925

2026
that.getProxyEndpoints = function () {
21-
return $http.get(PROXY_ENDPOINTS_FILE_NAME);
27+
let url;
28+
if (typeof PROXY_ENDPOINTS_FILE_NAME !== 'string') {
29+
url = 'proxy_endpoints.json';
30+
} else {
31+
url = PROXY_ENDPOINTS_FILE_NAME;
32+
}
33+
return $http.get(url);
2234
};
2335

2436
}

app/services/extractors/class-extractor.srv.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,12 @@ class ClassExtractor extends Extractor {
5555
} // end of constructor()
5656

5757
requestClasses() {
58-
var self = this;
59-
60-
var deferred = this.$q.defer();
61-
const promiseId = self.promises.addPromise(deferred);
58+
const deferred = this.$q.defer();
59+
const promiseId = this.promises.addPromise(deferred);
6260

6361
// do not request further classes
6462
if (this.nodes.hasClassNodes()) {
65-
self.$log.debug('[Classes] Skip loading further classes...');
63+
this.$log.debug('[Classes] Skip loading further classes...');
6664
deferred.resolve([]);
6765
return deferred.promise;
6866
}
@@ -71,17 +69,18 @@ class ClassExtractor extends Extractor {
7169

7270
let limit = this.reqConfig.getLimit() || 10;
7371

74-
var requestURL = this.reqConfig.getRequestURL();
72+
const requestURL = this.reqConfig.getRequestURL();
7573

76-
function doQuery(lastTry = false, offset = 0, limit = 10) {
74+
const self = this;
7775

76+
function doQuery(lastTry = false, offset = 0, limit = 10) {
7877
let query = self.queryFactory.getClassQuery(limit, offset);
7978

8079
self.$log.debug(`[Classes] Send Request with offset ${offset}...`);
8180
self.$http.get(requestURL, self.reqConfig.forQuery(query, deferred))
8281
.then(function handleExtractedClasses(response) {
8382
if (response.data.results !== undefined) {
84-
var bindings = response.data.results.bindings;
83+
let bindings = response.data.results.bindings;
8584

8685
if (bindings !== undefined) {
8786

app/services/extractors/relation-extractor.srv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class RelationExtractor extends Extractor {
5151
// create a new blacklist
5252
for (var type in PROPERTY_BLACKLIST) {
5353
if (PROPERTY_BLACKLIST.hasOwnProperty(type) && type !== 'SKOS') {
54-
for (var i = 0; i < PROPERTY_BLACKLIST[type].length; i++) {
54+
for (let i = 0; i < PROPERTY_BLACKLIST[type].length; i++) {
5555
this.blacklist.push(PREFIX[type] + PROPERTY_BLACKLIST[type][i]);
5656
}
5757
}

app/services/extractors/t-box-extractor.srv.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ function tBoxExtractor($q, $log, Data, Filters, StopWatch, Promises, ClassExtrac
2121

2222
self.classes = [];
2323

24+
/**
25+
* Start the extraction of TBox information by requesting classes.
26+
*/
2427
self.startTBoxExtraction = function () {
2528
StopWatch.start();
2629
ClassExtractor.requestClasses().then(function extractForClasses(results) {
@@ -41,7 +44,7 @@ function tBoxExtractor($q, $log, Data, Filters, StopWatch, Promises, ClassExtrac
4144
}
4245
}
4346

44-
var promises = [];
47+
let promises = [];
4548
for (let end = 0; end < self.classes.length; end++) {
4649
for (let start = 0; start < end; start++) {
4750
promises.push(RelationExtractor.requestClassEquality(self.classes[start], self.classes[end]));
@@ -93,7 +96,6 @@ function tBoxExtractor($q, $log, Data, Filters, StopWatch, Promises, ClassExtrac
9396
* Load relations for each pair of classes.
9497
*/
9598
self.extractRelations = function () {
96-
9799
$log.debug('[TBox Extractor] Send requests for relations...');
98100

99101
// for each pair of classes search relation and check equality

app/services/links.srv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function links(Geometry) {
3838
* @returns {number}
3939
*/
4040
self.getDistance = function (d) {
41-
var distance;
41+
let distance = 0;
4242
if ((d.target !== undefined && d.target.isLoopNode) || (d.source !== undefined && d.source.isLoopNode)) {
4343

4444
// loops

app/services/requests/request-counter.srv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function requestCounter($q, Requests) {
1818
return {
1919
'request': function (config) {
2020
// do not count requests for local files (e.g. templates or json)
21-
if (!config.url.match(localFileRegEx)) {
21+
if (config !== undefined && typeof config.url === 'string' && !config.url.match(localFileRegEx)) {
2222
Requests.incPendingRequests();
2323
}
2424
return config;

0 commit comments

Comments
 (0)