Skip to content

Instantly share code, notes, and snippets.

@edvakf
Created January 29, 2009 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edvakf/54425 to your computer and use it in GitHub Desktop.
Save edvakf/54425 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name mata wikipedia yonderu
// @include http://*.wikipedia.org/wiki/*
// @include http://twitter.com/public_timeline?from=userjs
// ==/UserScript==
(function() {
if (location.href.indexOf('wikipedia.org')>0) {
var wikipe = function() {
var object = document.createElement('object');
object.id = 'matawikipe';
object.style = 'visibility:hidden;position:fixed;height:1px;width:1px;top:0;left:0;';
setTimeout(
function() {
object.addEventListener('load',
function() {
object.contentWindow.postMessage(encodeURIComponent([
'「'+document.title.replace(/ - Wikipedia.*?$/,'')+'」',
location.href
].join(' ')), '*');
},false);
object.data = 'http://twitter.com/public_timeline?from=userjs';
}
,180000);
document.body.appendChild(object);
}
document.addEventListener('load', wikipe, false);
} else if (location.host == 'twitter.com') {
document.addEventListener('message',
function(e) {
if (e.domain.indexOf('wikipedia.org')<0 ) return;
var url = 'http://twitter.com/statuses/update.json';
var x = new XMLHttpRequest();
x.open('POST', url, true);
x.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
x.send('status=またWikipedia読んでる。' + e.data);
},
false);
}
})()
@Korb
Copy link

Korb commented Jul 27, 2022

What exactly does this script do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment