「MediaWiki:Common.js」の版間の差分

提供:作業療法大百科事典OtWiki
編集の要約なし
編集の要約なし
1行目: 1行目:
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */


document.addEventListener('DOMContentLoaded', function() {
window.onload = function () {


const share_url = location.href;
const share_url = location.href;
7行目: 7行目:
const share_title = document.title;
const share_title = document.title;


// facebook
const share_facebook = document.getElementById("js-share-facebook");
const share_facebook = document.getElementById("js-share-facebook");
share_facebook.setAttribute(
share_facebook.setAttribute(
13行目: 12行目:
);
);


// twitter
const share_twitter = document.getElementById("js-share-twitter");
const share_twitter = document.getElementById("js-share-twitter");
share_twitter.setAttribute(
share_twitter.setAttribute(
20行目: 18行目:
);
);


// line
const share_line = document.getElementById("js-share-line");
const share_line = document.getElementById("js-share-line");
share_line.setAttribute(
share_line.setAttribute(
27行目: 24行目:
);
);


// hatena
const share_hatena = document.getElementById("js-share-hatena");
const share_hatena = document.getElementById("js-share-hatena");
share_hatena.setAttribute(
share_hatena.setAttribute(
34行目: 30行目:
);
);


// pocket
const share_pocket = document.getElementById("js-share-pocket");
const share_pocket = document.getElementById("js-share-pocket");
share_pocket.setAttribute(
share_pocket.setAttribute(

2024年6月2日 (日) 06:35時点における版

/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */

window.onload = function () {

const share_url = location.href;
const share_hostpath = location.host + location.pathname;
const share_title = document.title;

const share_facebook = document.getElementById("js-share-facebook");
share_facebook.setAttribute(
	"href",	"http://www.facebook.com/share.php?u=" + share_url
);

const share_twitter = document.getElementById("js-share-twitter");
share_twitter.setAttribute(
	"href",
	"https://twitter.com/share?url=" + share_url + "&text=" + share_title
);

const share_line = document.getElementById("js-share-line");
share_line.setAttribute(
	"href",
	"https://social-plugins.line.me/lineit/share?url=" + share_url
);

const share_hatena = document.getElementById("js-share-hatena");
share_hatena.setAttribute(
	"href",
	"http://b.hatena.ne.jp/entry/s/" + share_hostpath
);

const share_pocket = document.getElementById("js-share-pocket");
share_pocket.setAttribute(
	"href",
	"http://getpocket.com/edit?url=" + share_url
);

alert('ページの読み込みが完了しました');

});