Corporation, Okinawa JAPAN
JavaScriptの常識は崩れ去る
HTML4とバイバイするために。
by CLI教の教祖様
[HTML]
<img class="animation" src="check.jpg"
style="position: absolute; left: 300px; top: 400px;" />
[JavaScriptの処理]
$(function() {
$(".animation").mouseover(function () {
$(this).animate({"left": "-=300px"}, 500);
});
}
[JavaScriptの処理]
$(".sound").mouseover(function () {
$.fn.soundPlay({url: 'sazae.mid', playerId: 'embed_player'
, command: 'play'});
});
function open_file(filePath){
var data = "";
try {
netscape.security.PrivilegeManager.enablePrivilege ('UniversalXPConnect');
var file = Components.classes["@mozilla.org/file/local;1"].createInstance (Components.interfaces.nsILocalFile);
file.initWithPath (filePath);
var fstream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
fstream.init(file, -1, 0, 0);
var charset = "UTF-8";
//const replacementChar = Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER;
replacementChar = Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER;
var is = Components.classes["@mozilla.org/intl/converter-input-stream;1"].createInstance(Components.interfaces.nsIConverterInputStream);
is.init(fstream, charset, 1024, replacementChar);
var str = {};
while (is.readString(4096, str) != 0) {
data += str.value;
}
} catch (e) {
throw e;
}
return data;
}
function writeToFile (filePath, content) {
try {
netscape.security.PrivilegeManager.enablePrivilege ('UniversalXPConnect');
var file = Components.classes["@mozilla.org/file/local;1"].createInstance (Components.interfaces.nsILocalFile);
file.initWithPath (filePath);
if (! file.exists ()) file.create (0, 0664);
var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance (Components.interfaces.nsIFileOutputStream);
out.init (file, 0x20 | 0x02, 00004, null);
var charset = "UTF-8";
var conv = Components.classes["\@mozilla.org/intl/converter-output-stream;1"].createInstance(Components.interfaces.nsIConverterOutputStream)
;
conv.init(out, charset, 0, 0x0000);
conv.writeString(content);
conv.close();
} catch (e) {
throw e;
}
}
シングルスレッドなのでsleepやwaitができません。
setTimeout('my_function()',1000);
(詳しくはホワイトボードで)
(詳しくはホワイトボードで)
JavaScriptで全てのアプケーションを書くことができる。