1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

continue jquery removal

This commit is contained in:
Luke Pulverenti 2016-06-02 13:08:25 -04:00
parent 1fba8135db
commit 3128b05f14
15 changed files with 115 additions and 103 deletions

View file

@ -15,12 +15,12 @@
}, },
"devDependencies": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.4.14", "version": "1.4.15",
"_release": "1.4.14", "_release": "1.4.15",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.4.14", "tag": "1.4.15",
"commit": "fd21288c33a836206b3f6322cd3205f63c2db53f" "commit": "0a71ddc9b55b812fb7c7059525a6a774c3423996"
}, },
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0", "_target": "^1.2.0",

View file

@ -176,6 +176,10 @@ define(['viewcontainer', 'focusManager', 'queryString', 'connectionManager', 'ev
}); });
}; };
self.currentView = function () {
return currentView;
};
self.dispatchPageEvents = function (value) { self.dispatchPageEvents = function (value) {
dispatchPageEvents = value; dispatchPageEvents = value;
}; };

View file

@ -30,14 +30,14 @@
"web-component-tester": "polymer/web-component-tester#^3.4.0" "web-component-tester": "polymer/web-component-tester#^3.4.0"
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/polymerelements/iron-a11y-announcer", "homepage": "https://github.com/PolymerElements/iron-a11y-announcer",
"_release": "1.0.4", "_release": "1.0.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.4", "tag": "v1.0.4",
"commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9" "commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9"
}, },
"_source": "git://github.com/polymerelements/iron-a11y-announcer.git", "_source": "git://github.com/PolymerElements/iron-a11y-announcer.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-a11y-announcer" "_originalSource": "PolymerElements/iron-a11y-announcer"
} }

View file

@ -30,14 +30,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/PolymerElements/iron-a11y-keys-behavior", "homepage": "https://github.com/polymerelements/iron-a11y-keys-behavior",
"_release": "1.1.2", "_release": "1.1.2",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.1.2", "tag": "v1.1.2",
"commit": "0c2330c229a6fd3d200e2b84147ec6f94f17c22d" "commit": "0c2330c229a6fd3d200e2b84147ec6f94f17c22d"
}, },
"_source": "git://github.com/PolymerElements/iron-a11y-keys-behavior.git", "_source": "git://github.com/polymerelements/iron-a11y-keys-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-a11y-keys-behavior" "_originalSource": "polymerelements/iron-a11y-keys-behavior"
} }

View file

@ -32,14 +32,14 @@
"web-component-tester": "^4.0.0", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-icon", "homepage": "https://github.com/PolymerElements/iron-icon",
"_release": "1.0.8", "_release": "1.0.8",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.8", "tag": "v1.0.8",
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb" "commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
}, },
"_source": "git://github.com/polymerelements/iron-icon.git", "_source": "git://github.com/PolymerElements/iron-icon.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-icon" "_originalSource": "PolymerElements/iron-icon"
} }

View file

@ -7,7 +7,7 @@
"list", "list",
"virtual-list" "virtual-list"
], ],
"version": "1.3.1", "version": "1.3.2",
"homepage": "https://github.com/PolymerElements/iron-list", "homepage": "https://github.com/PolymerElements/iron-list",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"
@ -45,14 +45,13 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.2", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.2",
"web-component-tester": "^4.0.0" "web-component-tester": "^4.0.0"
}, },
"_release": "1.3.1", "_release": "1.3.2",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.3.1", "tag": "v1.3.2",
"commit": "094724304d9df8c1c9cc5a8e62b9b607d4a0b86c" "commit": "5e6f1991f0b8f427b8432ce9538f3b100402545c"
}, },
"_source": "git://github.com/PolymerElements/iron-list.git", "_source": "git://github.com/PolymerElements/iron-list.git",
"_target": "^1.3.1", "_target": "^1.3.1",
"_originalSource": "PolymerElements/iron-list", "_originalSource": "PolymerElements/iron-list"
"_direct": true
} }

View file

@ -1,4 +1,3 @@
<!-- <!--
This file is autogenerated based on This file is autogenerated based on
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
@ -11,6 +10,7 @@ specific element:
jsbin=https://jsbin.com/cagaye/edit?html,output jsbin=https://jsbin.com/cagaye/edit?html,output
--> -->
# Polymer Elements # Polymer Elements
## Guide for Contributors ## Guide for Contributors

View file

@ -7,7 +7,7 @@
"list", "list",
"virtual-list" "virtual-list"
], ],
"version": "1.3.1", "version": "1.3.2",
"homepage": "https://github.com/PolymerElements/iron-list", "homepage": "https://github.com/PolymerElements/iron-list",
"authors": [ "authors": [
"The Polymer Authors" "The Polymer Authors"

View file

@ -620,7 +620,6 @@ will only render 20.
if (physicalOffset > this._scrollPosition) { if (physicalOffset > this._scrollPosition) {
return this.grid ? vidx - (vidx % this._itemsPerRow) : vidx; return this.grid ? vidx - (vidx % this._itemsPerRow) : vidx;
} }
// Handle a partially rendered final row in grid mode // Handle a partially rendered final row in grid mode
if (this.grid && this._virtualCount - 1 === vidx) { if (this.grid && this._virtualCount - 1 === vidx) {
return vidx - (vidx % this._itemsPerRow); return vidx - (vidx % this._itemsPerRow);
@ -639,21 +638,17 @@ will only render 20.
if (this._lastVisibleIndexVal === null) { if (this._lastVisibleIndexVal === null) {
if (this.grid) { if (this.grid) {
var lastIndex = this.firstVisibleIndex + this._estRowsInView * this._itemsPerRow - 1; var lastIndex = this.firstVisibleIndex + this._estRowsInView * this._itemsPerRow - 1;
this._lastVisibleIndexVal = lastIndex > this._virtualCount ? this._virtualCount : lastIndex; this._lastVisibleIndexVal = Math.min(this._virtualCount, lastIndex);
} else { } else {
var physicalOffset = this._physicalTop; var physicalOffset = this._physicalTop;
this._iterateItems(function(pidx, vidx) { this._iterateItems(function(pidx, vidx) {
physicalOffset += this._getPhysicalSizeIncrement(pidx); if (physicalOffset < this._scrollBottom) {
this._lastVisibleIndexVal = vidx;
if(physicalOffset <= this._scrollBottom) { } else {
if (this.grid) { // Break _iterateItems
var lastIndex = vidx - vidx % this._itemsPerRow + this._itemsPerRow - 1; return true;
this._lastVisibleIndexVal = lastIndex > this._virtualCount ? this._virtualCount : lastIndex;
} else {
this._lastVisibleIndexVal = vidx;
}
} }
physicalOffset += this._getPhysicalSizeIncrement(pidx);
}); });
} }
} }
@ -1067,10 +1062,11 @@ will only render 20.
this._virtualCount = this.items ? this.items.length : 0; this._virtualCount = this.items ? this.items.length : 0;
this._collection = this.items ? Polymer.Collection.get(this.items) : null; this._collection = this.items ? Polymer.Collection.get(this.items) : null;
this._physicalIndexForKey = {}; this._physicalIndexForKey = {};
this._firstVisibleIndexVal = null;
this._lastVisibleIndexVal = null;
this._resetScrollPosition(0); this._resetScrollPosition(0);
this._removeFocusedItem(); this._removeFocusedItem();
// create the initial physical items // create the initial physical items
if (!this._physicalItems) { if (!this._physicalItems) {
this._physicalCount = Math.max(1, Math.min(DEFAULT_PHYSICAL_COUNT, this._virtualCount)); this._physicalCount = Math.max(1, Math.min(DEFAULT_PHYSICAL_COUNT, this._virtualCount));
@ -1081,6 +1077,7 @@ will only render 20.
this._physicalStart = 0; this._physicalStart = 0;
} else if (change.path === 'items.splices') { } else if (change.path === 'items.splices') {
this._adjustVirtualIndex(change.value.indexSplices); this._adjustVirtualIndex(change.value.indexSplices);
this._virtualCount = this.items ? this.items.length : 0; this._virtualCount = this.items ? this.items.length : 0;
@ -1313,7 +1310,7 @@ will only render 20.
if (deltaHeight) { if (deltaHeight) {
this._physicalTop = this._physicalTop - deltaHeight; this._physicalTop = this._physicalTop - deltaHeight;
// juking scroll position during interial scrolling on iOS is no bueno // juking scroll position during interial scrolling on iOS is no bueno
if (!IOS_TOUCH_SCROLLING) { if (!IOS_TOUCH_SCROLLING && this._physicalTop !== 0) {
this._resetScrollPosition(this._scrollTop - deltaHeight); this._resetScrollPosition(this._scrollTop - deltaHeight);
} }
} }

View file

@ -81,55 +81,44 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}); });
}); });
test('first visible index', function(done) { test('first visible index', function() {
container.data = buildDataSet(100); container.data = buildDataSet(100);
Polymer.dom.flush();
assert.equal(list.firstVisibleIndex, 0);
list.scroll(0, container.itemHeight * 10);
list.fire('scroll');
assert.equal(list.firstVisibleIndex, 10);
list.scroll(0, container.itemHeight * 50);
list.fire('scroll');
assert.equal(list.firstVisibleIndex, 50);
list.scrollToIndex(60);
Polymer.dom.flush();
assert.equal(list.firstVisibleIndex, 60);
list.scrollToIndex(0);
Polymer.dom.flush();
assert.equal(list.firstVisibleIndex, 0);
});
flush(function() { test('last visible index', function() {
var setSize = list.items.length; container.data = buildDataSet(1);
var rowHeight = container.itemHeight; container.itemHeight = 1000;
var viewportHeight = list.offsetHeight; Polymer.dom.flush();
var scrollToItem; assert.equal(list.lastVisibleIndex, 0);
container.data = buildDataSet(2);
function checkFirstVisible() { container.itemHeight = 50;
assert.equal(list.firstVisibleIndex, scrollToItem); Polymer.dom.flush();
assert.equal(getFirstItemFromList(list).textContent, scrollToItem); assert.equal(list.lastVisibleIndex, 1);
} container.data = buildDataSet(10);
Polymer.dom.flush();
function checkLastVisible() { list.scrollToIndex(8);
var visibleItemsCount = Math.floor(viewportHeight / rowHeight); Polymer.dom.flush();
assert.equal(list.lastVisibleIndex, scrollToItem + visibleItemsCount - 1); assert.equal(list.lastVisibleIndex, 9);
assert.equal(getLastItemFromList(list).textContent, scrollToItem + visibleItemsCount - 1); container.itemHeight = 50;
} container.data = buildDataSet(100);
Polymer.dom.flush();
function doneScrollDown() { list.scroll(0, 100);
checkFirstVisible(); list.fire('scroll');
checkLastVisible(); assert.equal(list.lastVisibleIndex, ((list._scrollTop + container.listHeight) / container.itemHeight) - 1);
scrollToItem = 1;
flush(function() {
simulateScroll({
list: list,
contribution: rowHeight,
target: scrollToItem*rowHeight,
onScrollEnd: doneScrollUp
});
});
}
function doneScrollUp() {
checkFirstVisible();
checkLastVisible();
done();
}
scrollToItem = 50;
simulateScroll({
list: list,
contribution: 50,
target: scrollToItem*rowHeight,
onScrollEnd: doneScrollDown
});
});
}); });
test('scroll to index', function(done) { test('scroll to index', function(done) {
@ -161,6 +150,30 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}, 100); }, 100);
}); });
test('scroll to top', function(done) {
list.items = buildDataSet(100);
Polymer.dom.flush();
list.scrollToIndex(99);
Polymer.dom.flush();
list.scroll(0, 0);
setTimeout(function() {
assert.equal(list._scrollTop, 0, 'scrollTop = 0');
done();
}, 100);
});
test('scroll to a given scrollTop', function(done) {
list.items = buildDataSet(100);
Polymer.dom.flush();
list.scrollToIndex(99);
Polymer.dom.flush();
list.scroll(0, 500);
setTimeout(function() {
assert.equal(list._scrollTop, 500, 'scrollTop = 500');
done();
}, 100);
});
test('reset items', function(done) { test('reset items', function(done) {
list.items = buildDataSet(100); list.items = buildDataSet(100);

View file

@ -28,14 +28,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/polymerelements/iron-resizable-behavior", "homepage": "https://github.com/PolymerElements/iron-resizable-behavior",
"_release": "1.0.3", "_release": "1.0.3",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.3", "tag": "v1.0.3",
"commit": "dda1df6aaf452aedf3e52ff0cf69e72439452216" "commit": "dda1df6aaf452aedf3e52ff0cf69e72439452216"
}, },
"_source": "git://github.com/polymerelements/iron-resizable-behavior.git", "_source": "git://github.com/PolymerElements/iron-resizable-behavior.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-resizable-behavior" "_originalSource": "PolymerElements/iron-resizable-behavior"
} }

View file

@ -76,7 +76,7 @@ define(['browser'], function (browser) {
} }
if (currentPage) { if (currentPage) {
if (newViewInfo.hasScript) { if (newViewInfo.hasScript && window.$) {
// TODO: figure this out without jQuery // TODO: figure this out without jQuery
view = $(view).appendTo(mainAnimatedPages)[0]; view = $(view).appendTo(mainAnimatedPages)[0];
mainAnimatedPages.removeChild(currentPage); mainAnimatedPages.removeChild(currentPage);
@ -84,7 +84,7 @@ define(['browser'], function (browser) {
mainAnimatedPages.replaceChild(view, currentPage); mainAnimatedPages.replaceChild(view, currentPage);
} }
} else { } else {
if (newViewInfo.hasScript) { if (newViewInfo.hasScript && window.$) {
// TODO: figure this out without jQuery // TODO: figure this out without jQuery
view = $(view).appendTo(mainAnimatedPages)[0]; view = $(view).appendTo(mainAnimatedPages)[0];
} else { } else {

View file

@ -1,4 +1,7 @@
$.fn.buttonEnabled = function (enabled) { define(['jQuery'], function ($) {
return enabled ? this.attr('disabled', '').removeAttr('disabled') : this.attr('disabled', 'disabled'); $.fn.buttonEnabled = function (enabled) {
};
return enabled ? this.attr('disabled', '').removeAttr('disabled') : this.attr('disabled', 'disabled');
};
});

View file

@ -1,4 +1,4 @@
define(['datetime'], function (datetime) { define(['datetime', 'jQuery'], function (datetime, $) {
function renderNoHealthAlertsMessage(page) { function renderNoHealthAlertsMessage(page) {

View file

@ -1,4 +1,4 @@
define(['imageLoader', 'layoutManager', 'jQuery'], function (imageLoader, layoutManager, $) { define(['imageLoader', 'layoutManager', 'viewManager'], function (imageLoader, layoutManager, viewManager) {
var mainDrawerPanel = document.querySelector('.mainDrawerPanel'); var mainDrawerPanel = document.querySelector('.mainDrawerPanel');
@ -420,7 +420,7 @@
var pageIds = link.getAttribute('data-pageids'); var pageIds = link.getAttribute('data-pageids');
if (pageIds) { if (pageIds) {
selected = pageIds.split(',').indexOf($.mobile.activePage.id) != -1 selected = pageIds.split(',').indexOf(viewManager.currentView().id) != -1
} }
if (selected) { if (selected) {
@ -737,14 +737,12 @@
var html = title; var html = title;
if (window.$ && $.mobile) { var page = viewManager.currentView();
var page = $.mobile.activePage; if (page) {
if (page) { var helpUrl = page.getAttribute('data-helpurl');
var helpUrl = page.getAttribute('data-helpurl');
if (helpUrl) { if (helpUrl) {
html += '<a href="' + helpUrl + '" target="_blank" class="clearLink" style="margin-left:2em;" title="' + Globalize.translate('ButtonHelp') + '"><paper-button class="accent" style="margin:0;font-weight:normal;font-size:13px;padding:.25em;display:flex;align-items:center;"><iron-icon icon="info"></iron-icon><span>' + Globalize.translate('ButtonHelp') + '</span></paper-button></a>'; html += '<a href="' + helpUrl + '" target="_blank" class="clearLink" style="margin-left:2em;" title="' + Globalize.translate('ButtonHelp') + '"><paper-button class="accent" style="margin:0;font-weight:normal;font-size:13px;padding:.25em;display:flex;align-items:center;"><iron-icon icon="info"></iron-icon><span>' + Globalize.translate('ButtonHelp') + '</span></paper-button></a>';
}
} }
} }
@ -1078,9 +1076,7 @@
var admin = false; var admin = false;
if (!page) { if (!page) {
if (window.$ && window.$.mobile) { page = viewManager.currentView();
page = $.mobile.activePage;
}
} }
if (page && page.classList.contains('type-interior')) { if (page && page.classList.contains('type-interior')) {