Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.

Commit

Permalink
Upgrade jQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Mar 26, 2019
1 parent 738d249 commit f77c5ed
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 108 deletions.
64 changes: 27 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
},
"dependencies": {
"backbone": "^1.1.2",
"jquery": "^2.2.4",
"jquery": "^3.3.1",
"lunr": "^2.3.6",
"underscore": "^1.9.1"
},
"devDependencies": {
"@types/backbone": "^1.3.46",
"@types/jquery": "^2.0.53",
"@types/jquery": "^3.3.29",
"@types/lunr": "^2.3.2",
"@types/underscore": "^1.8.13",
"grunt": "^1.0.1",
Expand Down
8 changes: 2 additions & 6 deletions src/default/assets/js/src/typedoc/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ namespace typedoc
* Copy Backbone.Events to TypeScript class.
*/
if (typeof Backbone != 'undefined') {
typedoc.Events = <any>(function() {
var res = function() {};
_.extend(res.prototype, Backbone.Events);
return res;
})();
typedoc.Events = _.extend(function () {}, Backbone.Events);
}


Expand Down Expand Up @@ -158,4 +154,4 @@ namespace typedoc
return result;
}
}
}
}
32 changes: 17 additions & 15 deletions src/default/assets/js/src/typedoc/components/Filter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace typedoc
{
class FilterItem<T>
abstract class FilterItem<T>
{
protected key:string;

Expand All @@ -25,17 +25,11 @@ namespace typedoc
protected initialize() {}


protected handleValueChange(oldValue:T, newValue:T) {}
protected abstract handleValueChange(oldValue:T, newValue:T): void;

protected abstract fromLocalStorage(value: string): T;

protected fromLocalStorage(value:string):T {
return <any>value;
}


protected toLocalStorage(value:T):string {
return <any>value;
}
protected abstract toLocalStorage(value: T): string;


protected setValue(value:T) {
Expand Down Expand Up @@ -93,12 +87,12 @@ namespace typedoc
this.$select.addClass('active');
}).on('mouseleave', () => {
this.$select.removeClass('active');
}).on(pointerUp, 'li', (e:JQueryMouseEventObject) => {
}).on(pointerUp, 'li', (e) => {
this.$select.removeClass('active');
this.setValue($(e.target).attr('data-value'));
this.setValue(($(e.target).attr('data-value') || '').toString());
});

$document.on(pointerDown, (e:JQueryMouseEventObject) => {
$document.on(pointerDown, (e) => {
var $path = $(e.target).parents().addBack();
if ($path.is(this.$select)) return;

Expand All @@ -115,11 +109,19 @@ namespace typedoc
$html.removeClass('toggle-' + oldValue);
$html.addClass('toggle-' + newValue);
}

protected fromLocalStorage(value: string): string {
return value;
}

protected toLocalStorage(value: string): string {
return value;
}
}


class Filter extends Backbone.View<any>
{
{
private optionVisibility:FilterItemSelect;

private optionInherited:FilterItemCheckbox;
Expand Down Expand Up @@ -154,4 +156,4 @@ namespace typedoc
} else {
$html.addClass('no-filter');
}
}
}
6 changes: 3 additions & 3 deletions src/default/assets/js/src/typedoc/components/MenuHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ namespace typedoc
/**
* jQuery instance of the anchor tag.
*/
$anchor?:JQuery;
$anchor?: JQuery;

/**
* jQuery instance of the link in the navigation representing this anchor.
*/
$link?:JQuery;
$link?: JQuery<Node>;

/**
* The vertical offset of the anchor on the page.
*/
position:number;
position: number;
}


Expand Down
10 changes: 5 additions & 5 deletions src/default/assets/js/src/typedoc/components/MenuSticky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ namespace typedoc
this.setState('');

var containerTop = this.$container.offset()!.top;
var containerHeight = this.$container.height();
var containerHeight = this.$container.height() || 0;
var bottom = containerTop + containerHeight;
if (this.$navigation.height() < containerHeight) {
var elHeight = this.$el.height();
if (this.$navigation.height()! < containerHeight) {
var elHeight = this.$el.height() || 0;
var elTop = this.$el.offset()!.top;

if (this.$current.length) {
var currentHeight = this.$current.height();
var currentHeight = this.$current.height() || 0;
var currentTop = this.$current.offset()!.top;

this.$navigation.css('top', containerTop - currentTop + 20);
Expand Down Expand Up @@ -179,4 +179,4 @@ namespace typedoc
* Register this component.
*/
registerComponent(MenuSticky, '.menu-sticky');
}
}
4 changes: 2 additions & 2 deletions src/default/assets/js/src/typedoc/components/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ namespace typedoc.search
}

for (var i = 0, c = Math.min(10, res.length); i < c; i++) {
var row = data.rows[res[i].ref as any as number];
var row = data.rows[+res[i].ref];

// Bold the matched part of the query in the search results
var name = row.name.replace(new RegExp(query, 'i'), (match: string) => `<b>${match}</b>`);
Expand Down Expand Up @@ -273,7 +273,7 @@ namespace typedoc.search

setTimeout(() => setHasFocus(false), 100);
}).on('input', () => {
setQuery($.trim($field.val()));
setQuery($.trim(($field.val() || '').toString()));
}).on('keydown', (e:JQueryKeyEventObject) => {
if (e.keyCode == 13 || e.keyCode == 27 || e.keyCode == 38 || e.keyCode == 40) {
preventPress = true;
Expand Down
4 changes: 2 additions & 2 deletions src/default/assets/js/src/typedoc/components/Signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace typedoc
*
* @param e The related jQuery event object.
*/
private onClick(e:JQueryMouseEventObject) {
private onClick(e: JQuery.ClickEvent | JQuery.TouchEventBase) {
e.preventDefault();
_(this.groups).forEach((group, index) => {
if (group.$signature.is(e.currentTarget)) {
Expand All @@ -164,4 +164,4 @@ namespace typedoc
* Register this component.
*/
registerComponent(Signature, '.tsd-signatures');
}
}

0 comments on commit f77c5ed

Please sign in to comment.