Skip to content

Instantly share code, notes, and snippets.

@sters
Last active December 17, 2015 10:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sters/5596434 to your computer and use it in GitHub Desktop.
Save sters/5596434 to your computer and use it in GitHub Desktop.
ohirune
<!--
moved: https://github.com/sters/ohirunejs
-->
<html>
<body>
<a id="ohirune" target="_blank">おひるね</a>
<a id="okita" target="_blank">おきた</a>
<script type="text/javascript">
(function(){
function ohirune_web(mode){
var ohuton = ["[▓▓]", "[__]"];
var text = {
"okita" : ["おきたよっ", "ふわぁ…"],
"ohirune" : ["Zzz…", "おひるねするよっ"]
};
var kao = {
"okita" : "(:3",
"ohirune" : "(¦3"
};
var hashtag = " #おひるねサークル";
mode = mode || "okita";
if(kao[mode] == null || text[mode] == null)
return "なにかがおかしいよ";
var t = text[mode];
return t[parseInt(Math.random() * t.length)]
+ kao[mode]
+ ohuton[parseInt(Math.random() * ohuton.length)]
+ hashtag;
}
var share = "http://twitter.com/share?url=&text=";
var modes = ["okita", "ohirune"];
for(var i=0; i<modes.length; i++) {
(function(mode){
var element = document.getElementById(mode);
if(element == null) return;
element.onclick = function(){
this.href = share + encodeURIComponent(ohirune_web(mode));
};
element.onclick();
})(modes[i]);
}
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment