利用者:Tietew/metadata.js
表示
お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。
多くの Windows や Linux のブラウザ
- Ctrl を押しながら F5 を押す。
Mac における Safari
Mac における Chrome や Firefox
- ⌘ Cmd と ⇧ Shift を押しながら R を押す。
詳細についてはWikipedia:キャッシュを消すをご覧ください。
// This script is under public domain, and comes with ABSOLUTELY NO WARRANTY.
// You can use/modify/redistribute without any permission.
function foldmetadata() {
var caption, table, file, content;
var a, div, sw;
caption = document.getElementById('metadata');
if(!caption) return;
table = caption.parentNode;
file = document.getElementById('file');
content = file.parentNode;
div = document.createElement('div');
div.style.position = 'relative';
div.appendChild(table = table.parentNode.removeChild(table));
content.insertBefore(div, file);
table.setAttribute('align', null);
table.style.position = 'absolute';
table.style.top = '0';
table.style.right = '0';
table.style.zIndex = 1;
sw = document.createElement('span');
sw.style.position = 'absolute';
sw.style.top = '0';
sw.style.right = '0';
sw.style.zIndex = 2;
sw.appendChild(document.createTextNode(' ['));
a = document.createElement('a');
a.setAttribute('href', 'javascript:showhideMetadata();');
a.setAttribute('id', 'metadataShowhide');
a.setAttribute('title', 'metadata');
a.style.fontSize = '90%';
a.appendChild(document.createTextNode('show metadata'));
sw.appendChild(a);
sw.appendChild(document.createTextNode(']'));
div.appendChild(sw);
table.style.display = 'none';
}
function showhideMetadata() {
var e, a;
e = document.getElementById('metadata').parentNode;
a = document.getElementById('metadataShowhide');
if(e.style.display == 'none') {
e.style.display = '';
disp = 'hide';
} else {
e.style.display = 'none';
disp = 'show metadata';
}
if(a.innerText) a.innerText = disp;
else a.textContent = disp;
}
$(foldmetadata);