Fixed css & js for new articles data formatting
This commit is contained in:
parent
8239874d68
commit
3bb4326f09
3 changed files with 17 additions and 11 deletions
|
@ -20,7 +20,6 @@ def cleanUp(soup):
|
|||
[s.decompose() for s in content(['noscript'])]
|
||||
|
||||
[s.decompose() for s in content.findAll("a", {"id": "mw-mf-last-modified"})]
|
||||
[s.decompose() for s in content.findAll("span", {"class": "mw-editsection"})]
|
||||
[s.decompose() for s in content.findAll("a", {"class": "edit-page"})]
|
||||
[s.decompose() for s in content.findAll("table", {"class": "articleState"})]
|
||||
[s.decompose() for s in content.findAll("button", {"class": "languageSelector"})]
|
||||
|
|
|
@ -1001,7 +1001,7 @@ BLOCKQUOTE:after
|
|||
{
|
||||
width: 100%;
|
||||
}
|
||||
.client-js .section_heading
|
||||
.client-js H2
|
||||
{
|
||||
position: relative;
|
||||
background: no-repeat left 1.1em;
|
||||
|
@ -1012,7 +1012,11 @@ BLOCKQUOTE:after
|
|||
padding-left: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.client-js .section_heading.openSection
|
||||
.client-js H2
|
||||
{
|
||||
border-bottom: 1px solid #E2E3E4;
|
||||
}
|
||||
.client-js H2.openSection
|
||||
{
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAQCAYAAADnEwSWAAAAc0lEQVQ4ja3QSw2AQBCD4V8CUpC0AhGBBKTgYDhAAiGQ3Xbm0NM8vqREBEqACViBWb41oA0IYFdBFwoHzEAy6EKLAzpQu2ZNBS3osSOBNuSAKUgF05AClkCjYBk0ApZCPfALS0E/4Im9aiyBXuBdY+XzXg7oYrvAm9NaKAAAAABJRU5ErkJggg==);
|
||||
padding-right: 45px;
|
||||
|
@ -1045,11 +1049,11 @@ BLOCKQUOTE:after
|
|||
{
|
||||
border-bottom: none;
|
||||
}
|
||||
.page-loading .section_anchors, .page-loading .content_block, .client-js .content_block
|
||||
.page-loading .section_anchors, .page-loading .content_block, .client-js .content_block, h2 + div
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
.page-loading .section_anchors.openSection, .page-loading .content_block.openSection, .client-js .content_block.openSection
|
||||
.page-loading .section_anchors.openSection, .page-loading .content_block.openSection, .client-js .content_block.openSection, div.openSection
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
|
|
@ -37,16 +37,16 @@ function closeSection(section) {
|
|||
}
|
||||
|
||||
function openSection(section) {
|
||||
var sections = document.getElementsByClassName("section_heading");
|
||||
var sections = document.getElementsByTagName("h2");
|
||||
[].forEach.call(sections, function(sectionToClose) {
|
||||
closeSection(sectionToClose);
|
||||
});
|
||||
section.className += " openSection";
|
||||
section.className += "openSection";
|
||||
var contentSection = next(section);
|
||||
if (contentSection) {
|
||||
contentSection.className += " openSection";
|
||||
contentSection.className += "openSection";
|
||||
}
|
||||
location.replace('#' + section.id);
|
||||
location.replace('#' + section.children[0].id);
|
||||
window.history.replaceState({},"", window.location.href.split("#")[0] + '#' + section.id);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ function onSectionClick(event) {
|
|||
function onPageLoaded() {
|
||||
restoreImgSrcAttr();
|
||||
|
||||
var sections = document.getElementsByClassName("section_heading");
|
||||
var sections = document.getElementsByTagName("h2");
|
||||
[].forEach.call(sections, function(section) {
|
||||
addListener(section, 'click', onSectionClick);
|
||||
});
|
||||
|
@ -76,7 +76,10 @@ function onPageLoaded() {
|
|||
document.getElementById('articleImage').style.margin = "-" + rad + "px -" + rad + "px -" + rad + "px -" + rad + "px";
|
||||
};
|
||||
}
|
||||
img.src = document.getElementById('articleImage').style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi, '$2').split(',')[0];
|
||||
var imgElement = document.getElementById('articleImage');
|
||||
// Avoid exceptions during debugging, when articles can be without any images
|
||||
if (imgElement)
|
||||
img.src = imgElement.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi, '$2').split(',')[0];
|
||||
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue