MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 422: Line 422:
}
}
function foo() {
function setShowArticleRotationEffect() {
const offset = 15;
const showArticle = document.querySelector('#show-article');
const showArticle = document.querySelector('#show-article');
    const h = showArticle.clientHeight;
    const h = showArticle.clientHeight;
const a = Math.cos(Math.atan(10/h));
const a = Math.cos(Math.atan(offset/h));
const b = Math.sin(Math.atan(10/h));
const b = -Math.sin(Math.atan(offset/h));
const c = -Math.sin(Math.atan(10/h));
const c = Math.sin(Math.atan(offset/h));
const d = Math.cos(Math.atan(10/h));
const d = Math.cos(Math.atan(offset/h));
// $('#show-article').css('transform', `matrix(${a}, ${b}, ${c}, ${d}, 0, 0);`);
// `transform: matrix(1, -0.02, 0.02, 1, 0, 0);`
// Object.assign(showArticle.style, {
// transform: `matrix(${a}, ${b}, ${c}, ${d}, 0, 0);`,
// })
const showArticleBefore = document.querySelector('#show-article-before');
const showArticleBefore = document.querySelector('#show-article-before');
console.debug('>>>>>>', h, a, b, c, d);
const transformValue = 'matrix('+a+','+b+','+c+','+d+',0,0)';
const transformValue = 'matrix('+a+','+b+','+c+','+d+',0,0)'
console.debug(transformValue);
showArticleBefore.style.transform = transformValue;
showArticleBefore.style.transform = transformValue;
}
}
Line 447: Line 441:
    }
    }
    openModal(this, event); // Pass the event object to openModal
    openModal(this, event); // Pass the event object to openModal
    foo(1);
    setShowArticleRotationEffect();
});
});
$('#show-article-wrapper').on('mousedown', '.related-article', function(event) {
$('#show-article-wrapper').on('mousedown', '.related-article', function(event) {
    openModal(this, event); // Call openModal when a related-article is clicked
    openModal(this, event); // Call openModal when a related-article is clicked
    foo(2);
    setShowArticleRotationEffect();
});
});


Navigation menu