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": {},
"ignore": [],
"version": "1.4.14",
"_release": "1.4.14",
"version": "1.4.15",
"_release": "1.4.15",
"_resolution": {
"type": "version",
"tag": "1.4.14",
"commit": "fd21288c33a836206b3f6322cd3205f63c2db53f"
"tag": "1.4.15",
"commit": "0a71ddc9b55b812fb7c7059525a6a774c3423996"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_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) {
dispatchPageEvents = value;
};

View file

@ -30,14 +30,14 @@
"web-component-tester": "polymer/web-component-tester#^3.4.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-a11y-announcer",
"homepage": "https://github.com/PolymerElements/iron-a11y-announcer",
"_release": "1.0.4",
"_resolution": {
"type": "version",
"tag": "v1.0.4",
"commit": "5ce3eb8c4282bb53cd72e348858dc6be6b4c50b9"
},
"_source": "git://github.com/polymerelements/iron-a11y-announcer.git",
"_source": "git://github.com/PolymerElements/iron-a11y-announcer.git",
"_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"
},
"ignore": [],
"homepage": "https://github.com/PolymerElements/iron-a11y-keys-behavior",
"homepage": "https://github.com/polymerelements/iron-a11y-keys-behavior",
"_release": "1.1.2",
"_resolution": {
"type": "version",
"tag": "v1.1.2",
"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",
"_originalSource": "PolymerElements/iron-a11y-keys-behavior"
"_originalSource": "polymerelements/iron-a11y-keys-behavior"
}

View file

@ -32,14 +32,14 @@
"web-component-tester": "^4.0.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",
"_resolution": {
"type": "version",
"tag": "v1.0.8",
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
},
"_source": "git://github.com/polymerelements/iron-icon.git",
"_source": "git://github.com/PolymerElements/iron-icon.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-icon"
"_originalSource": "PolymerElements/iron-icon"
}

View file

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

View file

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

View file

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

View file

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

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);
flush(function() {
var setSize = list.items.length;
var rowHeight = container.itemHeight;
var viewportHeight = list.offsetHeight;
var scrollToItem;
function checkFirstVisible() {
assert.equal(list.firstVisibleIndex, scrollToItem);
assert.equal(getFirstItemFromList(list).textContent, scrollToItem);
}
function checkLastVisible() {
var visibleItemsCount = Math.floor(viewportHeight / rowHeight);
assert.equal(list.lastVisibleIndex, scrollToItem + visibleItemsCount - 1);
assert.equal(getLastItemFromList(list).textContent, scrollToItem + visibleItemsCount - 1);
}
function doneScrollDown() {
checkFirstVisible();
checkLastVisible();
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
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);
});
});
test('last visible index', function() {
container.data = buildDataSet(1);
container.itemHeight = 1000;
Polymer.dom.flush();
assert.equal(list.lastVisibleIndex, 0);
container.data = buildDataSet(2);
container.itemHeight = 50;
Polymer.dom.flush();
assert.equal(list.lastVisibleIndex, 1);
container.data = buildDataSet(10);
Polymer.dom.flush();
list.scrollToIndex(8);
Polymer.dom.flush();
assert.equal(list.lastVisibleIndex, 9);
container.itemHeight = 50;
container.data = buildDataSet(100);
Polymer.dom.flush();
list.scroll(0, 100);
list.fire('scroll');
assert.equal(list.lastVisibleIndex, ((list._scrollTop + container.listHeight) / container.itemHeight) - 1);
});
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);
});
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) {
list.items = buildDataSet(100);

View file

@ -28,14 +28,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-resizable-behavior",
"homepage": "https://github.com/PolymerElements/iron-resizable-behavior",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "dda1df6aaf452aedf3e52ff0cf69e72439452216"
},
"_source": "git://github.com/polymerelements/iron-resizable-behavior.git",
"_source": "git://github.com/PolymerElements/iron-resizable-behavior.git",
"_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 (newViewInfo.hasScript) {
if (newViewInfo.hasScript && window.$) {
// TODO: figure this out without jQuery
view = $(view).appendTo(mainAnimatedPages)[0];
mainAnimatedPages.removeChild(currentPage);
@ -84,7 +84,7 @@ define(['browser'], function (browser) {
mainAnimatedPages.replaceChild(view, currentPage);
}
} else {
if (newViewInfo.hasScript) {
if (newViewInfo.hasScript && window.$) {
// TODO: figure this out without jQuery
view = $(view).appendTo(mainAnimatedPages)[0];
} else {

View file

@ -1,4 +1,7 @@
$.fn.buttonEnabled = function (enabled) {
define(['jQuery'], function ($) {
$.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) {

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');
@ -420,7 +420,7 @@
var pageIds = link.getAttribute('data-pageids');
if (pageIds) {
selected = pageIds.split(',').indexOf($.mobile.activePage.id) != -1
selected = pageIds.split(',').indexOf(viewManager.currentView().id) != -1
}
if (selected) {
@ -737,8 +737,7 @@
var html = title;
if (window.$ && $.mobile) {
var page = $.mobile.activePage;
var page = viewManager.currentView();
if (page) {
var helpUrl = page.getAttribute('data-helpurl');
@ -746,7 +745,6 @@
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>';
}
}
}
var libraryMenuButtonText = document.querySelector('.libraryMenuButtonText');
if (libraryMenuButtonText) {
@ -1078,9 +1076,7 @@
var admin = false;
if (!page) {
if (window.$ && window.$.mobile) {
page = $.mobile.activePage;
}
page = viewManager.currentView();
}
if (page && page.classList.contains('type-interior')) {