Fix embed DOM classes

Classes, IDs and Names in the DOM have to begin with a letter. The $$hashKey
however might not, so prefix it with embed_. This also makes the classes more
unique, which is a good thing. Additionally, don't scroll on undefined should that
ever happen.

Fixes #45
This commit is contained in:
Lorenz Hübschle-Schneider 2014-02-15 14:42:53 +00:00 committed by David Cormier
parent 2e963da581
commit 93f40c64e9
2 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@
Hide {{ plugin.name }}
</button>
<div ng-bind-html="displayedContent" bo-class="plugin.$$hashKey"></div>
<div ng-bind-html="displayedContent" bo-class="'embed_' + plugin.$$hashKey"></div>
</div>
<div ng-hide="plugin.visible">

View File

@ -813,8 +813,10 @@ weechat.directive('plugin', function() {
// Scroll embed content into view
var scroll = function() {
var embed = document.querySelector("." + $scope.plugin.$$hashKey);
embed.scrollIntoViewIfNeeded();
var embed = document.querySelector(".embed_" + $scope.plugin.$$hashKey);
if (embed) {
embed.scrollIntoViewIfNeeded();
}
};
setTimeout(scroll, 100);
};