Created
May 20, 2016 16:08
-
-
Save NoxMortem/3f6ab46ef6d04e7a02cf400da65182b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on("sheet:opened change:repeating_attrmodkon remove:repeating_attrmodkon",function() { | |
TAS.repeating("attrmodkon") | |
.attrs("kon_mod") //< getting the attributes for the totals | |
.fields('value','active') //< specifying the fields we care about | |
.reduce(function(m,r){ | |
var active = r.active; | |
if(active == "on"){ | |
m += parseInt(r.I.value); //< Generate a running cost | |
} | |
return m; | |
},0,function(m,r,a){ | |
a.kon_mod = m; //< take the final sum and set it on the total attribute | |
}) | |
.execute(); //< begin executing the above operations | |
TAS.repeating("attrmodkon") | |
.attrs("kon_mod_tooltip") //< getting the attributes for the totals | |
.fields('name','value','active') //< specifying the fields we care about | |
.reduce(function(m,r){ | |
var row = ""; | |
if(r.active=="on"){ | |
row = "<tr><td>"+r.name+"</td><td>"+r.value+"</td></tr>"; | |
}else{ | |
row = "<tr><td>"+r.name+" (disabled)</td><td>"+r.value+"</td></tr>"; | |
} | |
m.desc.push(row); | |
return m; | |
},{desc: []},function(m,r,a){ | |
if(m.desc.length>0){ | |
a.kon_mod_tooltip = "<div class=\"sheet-chat-tooltip\"><table>"+m.desc.join('')+"</table></div>"; | |
}else{ | |
a.kon_mod_tooltip = ""; | |
} | |
}) | |
.execute(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment