MediaWiki:Embed.js: Difference between revisions
From TwogPedia
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
var twitter = document.querySelector("blockquote.twitter-tweet") | var twitter = document.querySelector("blockquote.twitter-tweet") | ||
var instagram = document.querySelector("blockquote.instagram-media") | var instagram = document.querySelector("blockquote.instagram-media") | ||
var facebook = document.querySelector(".fb-post") | |||
if ( reddit || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | if ( reddit || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | ||
if ( document.querySelector(".skin-citizen-dark") ) { | if ( document.querySelector(".skin-citizen-dark") ) { | ||
Line 13: | Line 14: | ||
if ( tiktok || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | if ( tiktok || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | ||
mw.loader.load( 'tiktok' ); | mw.loader.load( 'tiktok' ); | ||
} | } | ||
if ( twitter || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | if ( twitter || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | ||
if ( document.querySelector(".skin-citizen-dark") ) { | if ( document.querySelector(".skin-citizen-dark") ) { | ||
twitter.setAttribute('data-theme', 'dark'); | twitter.setAttribute('data-embed-theme', 'dark'); | ||
} | } | ||
mw.loader.load( 'twitter' ); | mw.loader.load( 'twitter' ); | ||
} | } | ||
if ( instagram || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | if ( instagram || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | ||
mw.loader.load( 'instagram' ); | mw.loader.load( 'instagram' ); | ||
} | |||
if ( facebook || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) { | |||
mw.loader.load( 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2' ); | |||
} | } | ||
}); | }); |
Revision as of 22:00, 12 May 2023
$(document).ready(function(){
var reddit = document.querySelector("blockquote.reddit-embed-bq")
var tiktok = document.querySelector("blockquote.tiktok-embed")
var twitter = document.querySelector("blockquote.twitter-tweet")
var instagram = document.querySelector("blockquote.instagram-media")
var facebook = document.querySelector(".fb-post")
if ( reddit || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) {
if ( document.querySelector(".skin-citizen-dark") ) {
reddit.setAttribute('data-embed-theme', 'dark');
}
mw.loader.load( 'reddit' );
}
if ( tiktok || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) {
mw.loader.load( 'tiktok' );
}
if ( twitter || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) {
if ( document.querySelector(".skin-citizen-dark") ) {
twitter.setAttribute('data-embed-theme', 'dark');
}
mw.loader.load( 'twitter' );
}
if ( instagram || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) {
mw.loader.load( 'instagram' );
}
if ( facebook || mw.config.get('wgAction') === 'formedit' || mw.config.get('wgAction') === 'edit' ) {
mw.loader.load( 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2' );
}
});
No categories