Skip to content

Instantly share code, notes, and snippets.

@bellflower2015
Last active August 29, 2015 14:24
Show Gist options
  • Save bellflower2015/8943cecdb827159dc87c to your computer and use it in GitHub Desktop.
Save bellflower2015/8943cecdb827159dc87c to your computer and use it in GitHub Desktop.
chrome bug fix for tyranoscript
// chrome_bug_fix.js
tyrano.plugin.kag.layer.forelay = function(layer) {
layer = layer || "";
for (key in this.map_layer_back)
if (layer == "" || layer == key) {
var fore_class_name = this.map_layer_fore[key].attr("class");
var back_class_name = this.map_layer_back[key].attr("class");
this.map_layer_fore[key] = this.map_layer_back[key].clone(true);
this.map_layer_fore[key].removeClass(back_class_name);
this.map_layer_fore[key].addClass(fore_class_name);
$("." + fore_class_name.replace(/ +/g, '.')).remove();
this.appendLayer(this.map_layer_fore[key]);
this.map_layer_back[key].css("display", "none");
}
};
tyrano.plugin.kag.layer.backlay = function(layer) {
layer = layer || "";
for (key in this.map_layer_fore)
if (key == 'base')
if (layer == "" || layer == key) {
var fore_class_name = this.map_layer_fore[key].attr("class");
var back_class_name = this.map_layer_back[key].attr("class");
this.map_layer_back[key] = this.map_layer_fore[key].clone();
this.map_layer_back[key].removeClass(fore_class_name);
this.map_layer_back[key].addClass(back_class_name);
$("." + back_class_name.replace(/ +/g, '.')).remove();
this.map_layer_back[key].hide();
this.appendLayer(this.map_layer_back[key])
}
for (key in this.map_layer_fore)
if (key.indexOf('message') != -1)
if (layer == "" || layer == key) {
var fore_class_name = this.map_layer_fore[key].attr("class");
var back_class_name = this.map_layer_back[key].attr("class");
this.map_layer_back[key] = this.map_layer_fore[key].clone();
this.map_layer_back[key].removeClass(fore_class_name);
this.map_layer_back[key].addClass(back_class_name);
$("." + back_class_name.replace(/ +/g, '.')).remove();
this.map_layer_back[key].hide();
this.appendLayer(this.map_layer_back[key])
}
for (key in this.map_layer_fore)
if (key != 'base' && key.indexOf('message') == -1)
if (layer == "" || layer == key) {
var fore_class_name = this.map_layer_fore[key].attr("class");
var back_class_name = this.map_layer_back[key].attr("class");
this.map_layer_back[key] = this.map_layer_fore[key].clone();
this.map_layer_back[key].removeClass(fore_class_name);
this.map_layer_back[key].addClass(back_class_name);
$("." + back_class_name.replace(/ +/g, '.')).remove();
this.map_layer_back[key].hide();
this.appendLayer(this.map_layer_back[key])
}
};
var trans_kag = tyrano.plugin.kag.ftag.master_tag.trans.kag;
tyrano.plugin.kag.tag.trans = {
vital: ["time"],
pm: {
layer: "base",
method: "crossfade",
children: true,
time: 1500
},
start: function(pm) {
this.kag.ftag.hideNextImg();
var that = this;
var comp_num = 0;
var layer_num = $.countObj(this.kag.layer.map_layer_fore);
if (pm.children == "false") layer_num = 0;
var _trans = function(key) {
var layer_fore = that.kag.layer.map_layer_fore[key];
var layer_back = that.kag.layer.map_layer_back[key];
if (key.indexOf("message") !=
-1 && layer_back.attr("l_visible") == "false") {
comp_num++;
that.kag.layer.forelay(key)
} else {
$.trans(pm.method, layer_fore, parseInt(pm.time), "hide", function() {});
layer_back.css("display", "none");
$.trans(pm.method, layer_back, parseInt(pm.time), "show", function() {
comp_num++;
that.kag.layer.forelay(key);
if (layer_num <= comp_num) that.kag.ftag.completeTrans();
that.kag.ftag.hideNextImg()
})
}
};
for (key in this.kag.layer.map_layer_fore)
if (key == 'base')
if (pm.children == true || key === pm.layer)
_trans(key);
for (key in this.kag.layer.map_layer_fore)
if (key.indexOf('message') != -1)
if (pm.children == true || key === pm.layer)
_trans(key);
for (key in this.kag.layer.map_layer_fore)
if (key != 'base' && key.indexOf('message') == -1)
if (pm.children == true || key === pm.layer)
_trans(key);
this.kag.ftag.nextOrder()
}
};
tyrano.plugin.kag.ftag.master_tag.trans = object(tyrano.plugin.kag.tag.trans);
tyrano.plugin.kag.ftag.master_tag.trans.kag = trans_kag;
// vim: set ft=javascript nopaste expandtab :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment