Why isn't my JavaScript saving data locally? - javascript

I try to have my game save, but it doesn't. When it does save, the program lags and resets. I want the game to save the player's $$$, XP, swag, and multiplier bonus. I have called my advisors, they cannot help the situation. I have been fidling with local data save and nothing will seem to work.
sad.png
cloud1.gif
//variables and stuff
var button = document.getElementById("mir");
var walletDisp = document.getElementById("walletDisp");
var xpDisp = document.getElementById("xplabel");
var test = document.getElementById("test");
var upgradeCashButton = document.getElementById("updaCash");
var upgradeCloudButton = document.getElementById("updaCloud");
var cloudLevelMax = 298123019;
var bonus = 100000;
var bonusCount = 2139871;
var wallet = 234018933098452034985;
var cashPerClick = 10000;
var xp = 132412341;
var cloudLevel = 320948;
var sad = true;
var aNiceTimer=setInterval(function(){myTimer()},1000);
//the "get her going" script
button.addEventListener("click", makeItRain, false);
upgradeCashButton.addEventListener("click",upgradeCash, false);
upgradeCloudButton.addEventListener("click",upgradeCloud, false);
xpDisp.addEventListener("click",credits, false);
window.onload = doInit();
chrome.runtime.onInstalled.addListener(function(details){
if(xp=="undefined"){
saveUs();
}
save();
});
function myTimer() {
if(sad===false){if(clicked===false){
document.body.style.backgroundImage="url('res/sad.jpg')";
sad = true;
bonus =1;
bonusCount = 0;
updateOutput();
}}
if(clicked){
bonusCount = bonusCount +.7;
}
if(bonusCount>bonus){
bonus = bonus+1;
bonusCount = 0;
updateOutput();
}
clicked = false;
}
function makeItRain(){
if(isNaN(wallet)){
saveUs();
}
wallet = wallet+cashPerClick*bonus;
if(sad===true){updateBackground();}
sad = false;
clicked = true;
xp = xp+bonus;
updateOutput();
}
function updateOutput(){
xpDisp.innerHTML = "Level "+ Math.round(Math.log(xp) / Math.log(10));
walletDisp.innerHTML = dispNumb(wallet)+"$";
upgradeCashButton.innerHTML = "Up to " +(dispNumb(getCashUpgrade())) +
" for "+ dispNumb(costOfCashUpgrade())+ "$";
upgradeCloudButton.innerHTML = "Add Swag? "+dispNumb(costOfCloudUpgrade())+"$";
if(clicked===true){
button.innerHTML = "Bonus: x "+ bonus;
}else{
button.innerHTML = "Rain those $$$";
}
if(wallet>=costOfCashUpgrade()){
upgradeCashButton.style.background='#6fae3c';
upgradeCashButton.style.border='3px solid #5f9e2c';
}else{
upgradeCashButton.style.background='#FA5858';
upgradeCashButton.style.border='3px solid #FE2E2E';
}
if(wallet>=costOfCloudUpgrade()){
upgradeCloudButton.style.background='#6fae3c';
upgradeCloudButton.style.border='3px solid #5f9e2c';
}else{
upgradeCloudButton.style.background='#FA5858';
upgradeCloudButton.style.border='3px solid #FE2E2E';
}
save();
}
function upgradeCash(){
if(wallet<costOfCashUpgrade()){
return;
}
wallet = wallet - costOfCashUpgrade();
cashPerClick = getCashUpgrade();
xp = xp+costOfCashUpgrade();
updateOutput();
}
function upgradeCloud(){
if(wallet<costOfCloudUpgrade()){
return;
}
if(cloudLevel==cloudLevelMax){
window.location='STOP.html';
return;
}
wallet = wallet - costOfCloudUpgrade();
cloudLevel = cloudLevel+1;
xp = xp+costOfCloudUpgrade();
updateBackground();
sad = false;
updateOutput();
}
function getCashUpgrade(){
numb = cashPerClick;
if(numb<10){
return numb+1;
}
var first = String(numb).charAt(0);
if(first=="1"){
first = "2";
}else if(first=="2"){
first = "5";
}else if(first=="5"){
first = "10";
}
var rest = String(numb).substring(1,String(numb).length);
return parseInt( first+""+rest);
}
function dispNumb(number){
var long = String(number).length;
var temp = 0;
var ending = "hi";
if(long<4){
return number;
}
if(long<7){
temp = Math.round(number/10)/100;
ending = "K";
}else if(long<10){
temp = Math.round(number/10000)/100;
ending = "M";
}else if(long<13){
temp = Math.round(number/10000000)/100;
ending = "B";
}else if(long<16){
temp = Math.round(number/10000000000)/100;
ending = "T";
}
temp = parseFloat(temp).toFixed(2);
return temp + " " +ending;
}
function costOfCashUpgrade(){
return Math.round(4*Math.round(10*cashPerClick*Math.log(cashPerClick)*Math.log(cashPerClick)))+1;
}
function updateBackground(){
document.body.style.backgroundImage="url('res/cloud"+cloudLevel+".gif')";
}
function costOfCloudUpgrade(){
return Math.round(10*Math.pow(4+cloudLevel,cloudLevel+3));
}
function save(){
chrome.storage.local.set({"wallet": wallet});
chrome.storage.local.set({"cashPerClick": cashPerClick});
chrome.storage.local.set({"xp": xp});
chrome.storage.local.set({"cloudLevel": cloudLevel});
}
function load(){
chrome.storage.local.get("wallet", function(item){
wallet = item["wallet"];
});
chrome.storage.local.get("cashPerClick", function(item){
cashPerClick = item["cashPerClick"];
});
chrome.storage.local.get("xp", function(item){
xp = item["xp"];
});
chrome.storage.local.get("cloudLevel", function(item){
cloudLevel = item["cloudLevel"];
});
}
function becomeOneWithWorld(){
var walB = 0;
var cpcB = 0;
var xpB = 0;
var clB = 0;
chrome.storage.sync.get("wallet", function(item){
walB = item["wallet"];
});
chrome.storage.sync.get("cashPerClick", function(item){
cpcB = item["cashPerClick"];
});
chrome.storage.sync.get("cloudLevel", function(item){
clB = item["cloudLevel"];
});
chrome.storage.sync.get("xp", function(item){
xpB = item["xp"];
});
setTimeout(function () {
if(xp>xpB){
chrome.storage.sync.set({"wallet": wallet});
chrome.storage.sync.set({"cashPerClick": cashPerClick});
chrome.storage.sync.set({"xp": xp});
chrome.storage.sync.set({"cloudLevel": cloudLevel});
}else{
chrome.storage.local.set({"wallet": walB});
chrome.storage.local.set({"cashPerClick": cpcB});
chrome.storage.local.set({"xp": xpB});
chrome.storage.local.set({"cloudLevel": clB});
}
load();
}, 100);
}
function saveUs(){
wallet = 0;
cashPerClick = 1;
xp = 1;
cloudLevel = 1;
}
function credits(){
window.location='credit.html';
}
function doInit(){
load();
becomeOneWithWorld();
}

You're using the wrong APIs. The chrome.storage and chrome.runtime APIs are for Chrome extensions, not web sites.
To store data using Javascript in a web page, use the LocalStorage API.

Related

Function call within a function not working

I have a function I call to initialize a page :
function initialize_selections() {
var freeamountElement = document.getElementById("text-freeamount");
var dlyElement = document.getElementById("text-dly");
var freeshipperElement = document.getElementById("text-freeshipper");
if(freeamountElement){
var shippingMethod = document.getElementById("text-freeamount").innerText;
document.getElementById('radio-freeamount').checked = true;
document.getElementById('value-shipping').innerHTML = '$0.00';
document.getElementById('text-shipping').innerHTML = shippingMethod;
}else if(dlyElement){
var shippingMethod = document.getElementById("text-dly").innerText;
document.getElementById('radio-dly').checked = true;
document.getElementById('value-shipping').innerHTML = '$0.00';
document.getElementById('text-shipping').innerHTML = shippingMethod;
}else if(freeshipperElement){
var shippingMethod = document.getElementById("text-freeshipper").innerText;
document.getElementById('radio-freeshipper').checked = true;
document.getElementById('value-shipping').innerHTML = '$0.00';
document.getElementById('text-shipping').innerHTML = shippingMethod;
}else{
var shippingMethod = document.getElementById("text-upsxml").innerText;
var shippingValue = document.getElementById("value-upsxml").innerText;
document.getElementById('radio-upsxml').checked = true;
document.getElementById('value-shipping').innerHTML = shippingValue;
document.getElementById('text-shipping').innerHTML = shippingMethod;
}
// myPoints();
};
This is working well on initial page load. Depending on specfic conditions I want to call it again, from a separate function:
function hideForm(){
if (document.getElementById('thebox').checked==true){
document.getElementById('formdiv').style.display="block";
document.getElementById('formdiv2').style.display="none";
document.getElementById('formdiv3').style.display="block";
var shipping_method = 'Pick Up Your Order';
document.getElementById('text-shipping').innerHTML = shipping_method ;
document.getElementById('value-shipping').innerHTML = '$0.00';
document.querySelector('input[name="shipping"]:checked').checked = false;
// myPoints();
} else {
document.getElementById('formdiv').style.display="none";
document.getElementById('formdiv2').style.display="block";
document.getElementById('formdiv3').style.display="none";
var shipping_method = document.getElementById('text-upsxml').innerText;
document.getElementById('text-shipping').innerHTML = shipping_method ;
var shipping_value = document.getElementById('value-upsxml').innerText;
document.getElementById('value-shipping').innerHTML = shipping_value;
document.querySelector('input[name="shipping"]:checked').checked = false;
document.querySelector('input[name="payment"]:checked').checked = false;
initialize_selections();
};
};
Both codes work well and do as I am looking for except that I can not call initialize_selections from hideForm (same thing occurs with the myPoints function, but commented it out to isolate the issue.

google docs apps script function calling very slow

I'm writing a google docs apps script in making a google docs add-on. When the user clicks a button in the sidebar, an apps script function is called named executeSpellChecking. This apps script function makes a remote POST call after getting the document's text.
total time = time that takes from when user clicks the button, until the .withSuccessHandler(, that means until executeSpellChecking returns = 2000 ms
function time = time that takes for the executeSpellChecking call to complete from its start to its end = 1400 ms
t3 = time that takes for the remote POST call to be completed = 800ms
t4 = time that takes for the same remote POST call to complete in a VB.NET app = 200ms
Problems:
Why total time to complete is bigger than total function time by a staggering 600ms, what else happens there? shouldn't they be equal? How can I improve it?
Why t3 is bigger than t4 ? Shouldn't they be equal? Is there something wrong with POST requests when happening from .gs? How can I improve it ?
the code is (sidebar.html):
function runSpellChecking() {
gb_IsSpellcheckingRunning = true;
//gb_isAutoCorrecting = false;
gi_CorrectionCurrWordIndex = -1;
$("#btnStartCorr").attr("disabled", true);
$("#divMistakes").html("");
this.disabled = true;
//$('#error').remove();
var origin = $('input[name=origin]:checked').val();
var dest = $('input[name=dest]:checked').val();
var savePrefs = $('#save-prefs').is(':checked');
//var t1 = new Date().getTime();
console.time("total time");
google.script.run
.withSuccessHandler(
function(textAndTranslation, element) {
if (gb_IsSpellCheckingEnabled) {
console.timeEnd("total time");
//var t2 = new Date().getTime();
go_TextAndTranslation = JSON.parse(JSON.stringify(textAndTranslation));
var pagewords = textAndTranslation.pagewords;
var spellchecked = textAndTranslation.spellchecked;
//alert("total time to complete:" + (t2-t1) + "###" + go_TextAndTranslation.time);
//irrelevant code follows below...
}
})
.withFailureHandler(
function(msg, element) {
showError(msg, $('#button-bar'));
element.disabled = false;
})
.withUserObject(this)
.executeSpellChecking(origin, dest, savePrefs);
}
and the called function code is (spellcheck.gs):
function executeSpellChecking(origin, dest, savePrefs) {
//var t1 = new Date().getTime();
console.time("function time");
var body = DocumentApp.getActiveDocument().getBody();
var alltext = body.getText();
var lastchar = alltext.slice(-1);
if (lastchar != " " && lastchar != "\n") {
body.editAsText().insertText(alltext.length, "\n");
alltext = body.getText();
}
var arr_alltext = alltext.split(/[\s\n]/);
var pagewords = new Object;
var pagewordsOrig = new Object;
var pagewordsOrigOffset = new Object;
var offset = 0;
var curWord = "";
var cnt = 0;
for (var i = 0; i < arr_alltext.length; i++) {
curWord = arr_alltext[i];
if (StringHasSimeioStiksis(curWord)) {
curWord = replaceSimeiaStiksis(curWord);
var arr3 = curWord.split(" ");
for (var k = 0; k < arr3.length; k++) {
curWord = arr3[k];
pagewords["" + (cnt+1).toString()] = curWord.replace(/[`~##$%^&*()_|+\-="<>\{\}\[\]\\\/]/gi, '');
pagewordsOrig["" + (cnt+1).toString()] = curWord;
pagewordsOrigOffset["" + (cnt+1).toString()] = offset;
offset += curWord.length;
cnt++;
}
offset++;
} else {
pagewords["" + (cnt+1).toString()] = curWord.replace(/[`~##$%^&*()_|+\-="<>\{\}\[\]\\\/\n]/gi, '');
pagewordsOrig["" + (cnt+1).toString()] = curWord;
pagewordsOrigOffset["" + (cnt+1).toString()] = offset;
offset += curWord.length + 1;
cnt++;
}
}
var respTString = "";
var url = 'https://www.example.org/spellchecker.php';
var data = {
"Text" : JSON.stringify(pagewords),
"idOffset" : "0",
"lexID" : "8",
"userEmail" : "test#example.org"
};
var payload = JSON.stringify(data);
var options = {
"method" : "POST",
"contentType" : "application/json",
"payload" : payload
};
//var t11 = new Date().getTime();
console.time("POST time");
var response = UrlFetchApp.fetch(url, options);
console.timeEnd("POST time");
//var t22 = new Date().getTime();
var resp = response.getContentText();
respTString = resp;
var spellchecked = JSON.parse(respTString);
var style = {};
for (var k in pagewords){
if (pagewords.hasOwnProperty(k)) {
if (spellchecked.hasOwnProperty(k)) {
if (spellchecked[k].substr(0, 1) == "1") {
style[DocumentApp.Attribute.FOREGROUND_COLOR] = "#000000";
}
if (spellchecked[k].substr(0, 1) == "0") {
style[DocumentApp.Attribute.FOREGROUND_COLOR] = "#FF0000";
}
if (spellchecked[k].substr(0, 1) == "4") {
style[DocumentApp.Attribute.FOREGROUND_COLOR] = "#0000FF";
}
if (pagewordsOrigOffset[k] < alltext.length) {
body.editAsText().setAttributes(pagewordsOrigOffset[k], pagewordsOrigOffset[k] + pagewordsOrig[k].length, style);
}
}
}
}
//var t2 = new Date().getTime();
console.timeEnd("function time")
return {
"pagewords" : pagewords,
"pagewordsOrig" : pagewordsOrig,
"pagewordsOrigOffset" : pagewordsOrigOffset,
"spellchecked" : spellchecked
}
}
Thank you in advance for any help.
EDIT: I updated the code to use console.time according to the suggestion, the results are:
total time: 2048.001953125 ms
Jun 21, 2021, 3:01:40 PM Debug POST time: 809ms
Jun 21, 2021, 3:01:41 PM Debug function time: 1408ms
So the problem is not how time is measured. function time is 1400ms, while the time it takes to return is 2000ms, a difference of 600ms and the POST time is a staggering 800ms, instead of 200ms it takes in VB.net to make the exact same POST call.
Use console.time() and console.timeEnd():
https://developers.google.com/apps-script/reference/base/console
I modified the code for you. console.timeEnd() outputs the time duration in the console automatically, so I removed the alert for you that showed the time difference.
You might want the strings that I used as the parameter as some sort of constant variable, so there are no magic strings used twice. I hope this is of use to you.
function runSpellChecking() {
gb_IsSpellcheckingRunning = true;
//gb_isAutoCorrecting = false;
gi_CorrectionCurrWordIndex = -1;
$("#btnStartCorr").attr("disabled", true);
$("#divMistakes").html("");
this.disabled = true;
//$('#error').remove();
var origin = $('input[name=origin]:checked').val();
var dest = $('input[name=dest]:checked').val();
var savePrefs = $('#save-prefs').is(':checked');
console.time("total time");
google.script.run
.withSuccessHandler(
function(textAndTranslation, element) {
if (gb_IsSpellCheckingEnabled) {
console.timeEnd("total time");
go_TextAndTranslation = JSON.parse(JSON.stringify(textAndTranslation));
var pagewords = textAndTranslation.pagewords;
var spellchecked = textAndTranslation.spellchecked;
//irrelevant code follows below...
}
})
.withFailureHandler(
function(msg, element) {
showError(msg, $('#button-bar'));
element.disabled = false;
})
.withUserObject(this)
.executeSpellChecking(origin, dest, savePrefs);
}
function executeSpellChecking(origin, dest, savePrefs) {
console.time("function time");
var body = DocumentApp.getActiveDocument().getBody();
var alltext = body.getText();
var lastchar = alltext.slice(-1);
if (lastchar != " " && lastchar != "\n") {
body.editAsText().insertText(alltext.length, "\n");
alltext = body.getText();
}
var arr_alltext = alltext.split(/[\s\n]/);
var pagewords = new Object;
var pagewordsOrig = new Object;
var pagewordsOrigOffset = new Object;
var offset = 0;
var curWord = "";
var cnt = 0;
for (var i = 0; i < arr_alltext.length; i++) {
curWord = arr_alltext[i];
if (StringHasSimeioStiksis(curWord)) {
curWord = replaceSimeiaStiksis(curWord);
var arr3 = curWord.split(" ");
for (var k = 0; k < arr3.length; k++) {
curWord = arr3[k];
pagewords["" + (cnt+1).toString()] = curWord.replace(/[`~##$%^&*()_|+\-="<>\{\}\[\]\\\/]/gi, '');
pagewordsOrig["" + (cnt+1).toString()] = curWord;
pagewordsOrigOffset["" + (cnt+1).toString()] = offset;
offset += curWord.length;
cnt++;
}
offset++;
} else {
pagewords["" + (cnt+1).toString()] = curWord.replace(/[`~##$%^&*()_|+\-="<>\{\}\[\]\\\/\n]/gi, '');
pagewordsOrig["" + (cnt+1).toString()] = curWord;
pagewordsOrigOffset["" + (cnt+1).toString()] = offset;
offset += curWord.length + 1;
cnt++;
}
}
var respTString = "";
var url = 'https://www.example.org/spellchecker.php';
var data = {
"Text" : JSON.stringify(pagewords),
"idOffset" : "0",
"lexID" : "8",
"userEmail" : "test#example.org"
};
var payload = JSON.stringify(data);
var options = {
"method" : "POST",
"contentType" : "application/json",
"payload" : payload
};
console.time("POST time");
var response = UrlFetchApp.fetch(url, options);
console.timeEnd("POST time");
var resp = response.getContentText();
respTString = resp;
var spellchecked = JSON.parse(respTString);
var style = {};
for (var k in pagewords){
if (pagewords.hasOwnProperty(k)) {
if (spellchecked.hasOwnProperty(k)) {
if (spellchecked[k].substr(0, 1) == "1") {
style[DocumentApp.Attribute.FOREGROUND_COLOR] = "#000000";
}
if (spellchecked[k].substr(0, 1) == "0") {
style[DocumentApp.Attribute.FOREGROUND_COLOR] = "#FF0000";
}
if (spellchecked[k].substr(0, 1) == "4") {
style[DocumentApp.Attribute.FOREGROUND_COLOR] = "#0000FF";
}
if (pagewordsOrigOffset[k] < alltext.length) {
body.editAsText().setAttributes(pagewordsOrigOffset[k], pagewordsOrigOffset[k] + pagewordsOrig[k].length, style);
}
}
}
}
console.timeEnd("function time");
return {
"pagewords" : pagewords,
"pagewordsOrig" : pagewordsOrig,
"pagewordsOrigOffset" : pagewordsOrigOffset,
"spellchecked" : spellchecked
}
}

Embedded Font Not Displaying On Other Devices (AS3, Javascript)

So I've written a bit of code in Actionscript 3.0 that displays a string when you hover over a word on screen. The issue with this however is that when displayed on other devices such as a Windows desktop, the font reverts back to default. I've checked Adobe Animate and my fonts are all embedded correctly in the preferences so I'm assuming something is missing in my code which I've listed here:
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.Font
import com.adobe.tvsdk.mediacore.TextFormat;
stop();
Previous3.addEventListener(MouseEvent.CLICK, Frame4_prev);
function Frame4_prev(event:MouseEvent):void
{
gotoAndStop(3);
}
Next3.addEventListener(MouseEvent.CLICK, Frame4_next);
function Frame4_next(event:MouseEvent):void
{
gotoAndStop(5);
}
/* ---------- HOVER CHART WITH INFO ---------- */
/* MUCH_info (1) */
MUCH_info.addEventListener(MouseEvent.MOUSE_OVER, over1);
MUCH_info.addEventListener(MouseEvent.MOUSE_OUT, out1);
var fl_TF1:TextField;
var textformat1:TextFormat = new TextFormat;
var i1:int = 20;
var fl_TextToDisplay1:String =
"My Utility Cabinet Holdings, LLC";
function over1(event:MouseEvent):void
{
MUCH_info.visible = true;
fl_TF1 = new TextField();
fl_TF1.autoSize = TextFieldAutoSize.LEFT;
fl_TF1.background = false;
fl_TF1.border = false;
fl_TF1.x = 125;
fl_TF1.y = 643;
fl_TF1.text = fl_TextToDisplay1;
addChild(fl_TF1);
textformat1.size = i1;
textformat1.font = "Europa-Regular";
fl_TF1.setTextFormat(textformat1);
}
function out1(event:MouseEvent):void
{
fl_TF1.visible = false;
}
/* RealMTRX_info (2) */
RealMTRX_info.addEventListener(MouseEvent.MOUSE_OVER, over2);
RealMTRX_info.addEventListener(MouseEvent.MOUSE_OUT, out2);
var fl_TF2:TextField;
var textformat2:TextFormat = new TextFormat;
var i2:int = 21;
var fl_TextToDisplay2:String =
"Specializes in tenant billing, sub-metering, and green initiatives";
function over2(event:MouseEvent):void
{
RealMTRX_info.visible = true;
fl_TF2 = new TextField();
fl_TF2.autoSize = TextFieldAutoSize.LEFT;
fl_TF2.background = false;
fl_TF2.border = false;
fl_TF2.x = 125;
fl_TF2.y = 643;
fl_TF2.text = fl_TextToDisplay2;
addChild(fl_TF2);
textformat2.size = i2;
textformat2.font = "Europa-Regular";
fl_TF2.setTextFormat(textformat2);
}
function out2(event:MouseEvent):void
{
fl_TF2.visible = false;
}
/* MUCSaaS_info (3) */
MUCSaaS_info.addEventListener(MouseEvent.MOUSE_OVER, over3);
MUCSaaS_info.addEventListener(MouseEvent.MOUSE_OUT, out3);
var fl_TF3:TextField;
var textformat3:TextFormat = new TextFormat;
var i3:int = 18;
var fl_TextToDisplay3:String =
"An invoice management system able to track, centralize, and analyze billing data";
function over3(event:MouseEvent):void
{
MUCSaaS_info.visible = true;
fl_TF3 = new TextField();
fl_TF3.autoSize = TextFieldAutoSize.LEFT;
fl_TF3.background = false;
fl_TF3.border = false;
fl_TF3.x = 90;
fl_TF3.y = 643;
fl_TF3.text = fl_TextToDisplay3;
addChild(fl_TF3);
textformat3.size = i3;
textformat3.font = "Europa-Regular";
fl_TF3.setTextFormat(textformat3);
}
function out3(event:MouseEvent):void
{
fl_TF3.visible = false;
}
/* MagnaData_info (4) */
MagnaData_info.addEventListener(MouseEvent.MOUSE_OVER, over4);
MagnaData_info.addEventListener(MouseEvent.MOUSE_OUT, out4);
var fl_TF4:TextField;
var textformat4:TextFormat = new TextFormat;
var i4:int = 20;
var fl_TextToDisplay4:String =
"Develops internal system design and updates, robotics, and data mining";
function over4(event:MouseEvent):void
{
MagnaData_info.visible = true;
fl_TF4 = new TextField();
fl_TF4.autoSize = TextFieldAutoSize.LEFT;
fl_TF4.background = false;
fl_TF4.border = false;
fl_TF4.x = 90;
fl_TF4.y = 643;
fl_TF4.text = fl_TextToDisplay4;
addChild(fl_TF4);
textformat4.size = i4;
textformat4.font = "EuropaRegular";
fl_TF4.setTextFormat(textformat4);
}
function out4(event:MouseEvent):void
{
fl_TF4.visible = false;
}
/* GeoMAH_info (5) */
GeoMAH_info.addEventListener(MouseEvent.MOUSE_OVER, over5);
GeoMAH_info.addEventListener(MouseEvent.MOUSE_OUT, out5);
var fl_TF5:TextField;
var textformat5:TextFormat = new TextFormat;
var i5:int = 18;
var fl_TextToDisplay5:String =
"Specializes in data trends and anomalies, cost efficiency, and client consultation";
function over5(event:MouseEvent):void
{
GeoMAH_info.visible = true;
fl_TF5 = new TextField();
fl_TF5.autoSize = TextFieldAutoSize.LEFT;
fl_TF5.background = false;
fl_TF5.border = false;
fl_TF5.x = 90;
fl_TF5.y = 643;
fl_TF5.text = fl_TextToDisplay5;
addChild(fl_TF5);
textformat5.size = i5;
textformat5.font = "EuropaRegular";
fl_TF5.setTextFormat(textformat5);
}
function out5(event:MouseEvent):void
{
fl_TF5.visible = false;
}
/* SST_info (6) */
SST_info.addEventListener(MouseEvent.MOUSE_OVER, over6);
SST_info.addEventListener(MouseEvent.MOUSE_OUT, out6);
var fl_TF6:TextField;
var textformat6:TextFormat = new TextFormat;
var i6:int = 20;
var fl_TextToDisplay6:String =
"Outside services that help maintain the MUC website";
function over6(event:MouseEvent):void
{
SST_info.visible = true;
fl_TF6 = new TextField();
fl_TF6.autoSize = TextFieldAutoSize.LEFT;
fl_TF6.background = false;
fl_TF6.border = false;
fl_TF6.x = 100;
fl_TF6.y = 643;
fl_TF6.text = fl_TextToDisplay6;
addChild(fl_TF6);
textformat6.size = i6;
textformat6.font = "Europa-Regular";
fl_TF6.setTextFormat(textformat6);
}
function out6(event:MouseEvent):void
{
fl_TF6.visible = false;
}
/* Tamara_info (7) */
Tamara_info.addEventListener(MouseEvent.MOUSE_OVER, over7);
Tamara_info.addEventListener(MouseEvent.MOUSE_OUT, out7);
var fl_TF7:TextField;
var textformat7:TextFormat = new TextFormat;
var i7:int = 20;
var fl_TextToDisplay7:String =
"Tamara Naser, President";
function over7(event:MouseEvent):void
{
Tamara_info.visible = true;
fl_TF7 = new TextField();
fl_TF7.autoSize = TextFieldAutoSize.LEFT;
fl_TF7.background = false;
fl_TF7.border = false;
fl_TF7.x = 125;
fl_TF7.y = 643;
fl_TF7.text = fl_TextToDisplay7;
addChild(fl_TF7);
textformat7.size = i7;
textformat7.font = "Europa-Regular";
fl_TF7.setTextFormat(textformat7);
}
function out7(event:MouseEvent):void
{
fl_TF7.visible = false;
}
/* DataEntry_info (8) */
DataEntry_info.addEventListener(MouseEvent.MOUSE_OVER, over8);
DataEntry_info.addEventListener(MouseEvent.MOUSE_OUT, out8);
var fl_TF8:TextField;
var textformat8:TextFormat = new TextFormat ();
var i8:int = 20;
var fl_TextToDisplay8:String =
"Acquires, manages, and enters client invoice data";
function over8(event:MouseEvent):void
{
DataEntry_info.visible = true;
fl_TF8 = new TextField();
fl_TF8.autoSize = TextFieldAutoSize.LEFT;
fl_TF8.background = false;
fl_TF8.border = false;
fl_TF8.x = 100;
fl_TF8.y = 643;
fl_TF8.text = fl_TextToDisplay8;
addChild(fl_TF8);
textformat8.size = i8;
textformat8.font = "Europa-Regular";
fl_TF8.setTextFormat(textformat8);
}
function out8(event:MouseEvent):void
{
fl_TF8.visible = false;
}
/* Control_info (9) */
Control_info.addEventListener(MouseEvent.MOUSE_OVER, over9);
Control_info.addEventListener(MouseEvent.MOUSE_OUT, out9);
var fl_TF9:TextField;
var textformat9:TextFormat = new TextFormat;
var i9:int = 20;
var fl_TextToDisplay9:String =
"Ensures the integrity and quality of data";
function over9(event:MouseEvent):void
{
Control_info.visible = true;
fl_TF9 = new TextField();
fl_TF9.autoSize = TextFieldAutoSize.LEFT;
fl_TF9.background = false;
fl_TF9.border = false;
fl_TF9.x = 100;
fl_TF9.y = 643;
fl_TF9.text = fl_TextToDisplay9;
addChild(fl_TF9);
textformat9.size = i9;
textformat9.font = "Europa-Regular";
fl_TF9.setTextFormat(textformat9);
}
function out9(event:MouseEvent):void
{
fl_TF9.visible = false;
}
/* Finance_info (10) */
Finance_info.addEventListener(MouseEvent.MOUSE_OVER, over10);
Finance_info.addEventListener(MouseEvent.MOUSE_OUT, out10);
var fl_TF10:TextField;
var textformat10:TextFormat = new TextFormat;
var i10:int = 19;
var fl_TextToDisplay10:String =
"Assesses, monitors, and plans the utilization of cash and financial services";
function over10(event:MouseEvent):void
{
Finance_info.visible = true;
fl_TF10 = new TextField();
fl_TF10.autoSize = TextFieldAutoSize.LEFT;
fl_TF10.background = false;
fl_TF10.border = false;
fl_TF10.x = 90;
fl_TF10.y = 643;
fl_TF10.text = fl_TextToDisplay10;
addChild(fl_TF10);
textformat10.size = i10;
textformat10.font = "Europa-Regular";
fl_TF10.setTextFormat(textformat10);
}
function out10(event:MouseEvent):void
{
fl_TF10.visible = false;
}
/* Admin_info (11) */
Admin_info.addEventListener(MouseEvent.MOUSE_OVER, over11);
Admin_info.addEventListener(MouseEvent.MOUSE_OUT, out11);
var fl_TF11:TextField;
var textformat11:TextFormat = new TextFormat;
var i11:int = 20;
var fl_TextToDisplay11:String =
"Acquires and manages physical invoices and handles other projects";
function over11(event:MouseEvent):void
{
HR_info.visible = true;
fl_TF11 = new TextField();
fl_TF11.autoSize = TextFieldAutoSize.LEFT;
fl_TF11.background = false;
fl_TF11.border = false;
fl_TF11.x = 100;
fl_TF11.y = 643;
fl_TF11.text = fl_TextToDisplay11;
addChild(fl_TF11);
textformat11.size = i11;
textformat11.font = "Europa-Regular";
fl_TF11.setTextFormat(textformat11);
}
function out11(event:MouseEvent):void
{
fl_TF11.visible = false;
}
/* HR_info (12) */
HR_info.addEventListener(MouseEvent.MOUSE_OVER, over12);
HR_info.addEventListener(MouseEvent.MOUSE_OUT, out12);
var fl_TF12:TextField;
var textformat12:TextFormat = new TextFormat;
var i12:int = 20;
var fl_TextToDisplay12:String =
"Manages hiring and onboarding of employees and employee relations";
function over12(event:MouseEvent):void
{
HR_info.visible = true;
fl_TF12 = new TextField();
fl_TF12.autoSize = TextFieldAutoSize.LEFT;
fl_TF12.background = false;
fl_TF12.border = false;
fl_TF12.x = 100;
fl_TF12.y = 643;
fl_TF12.text = fl_TextToDisplay12;
addChild(fl_TF12);
textformat12.size = i12;
textformat12.font = "Europa-Regular";
fl_TF12.setTextFormat(textformat12);
}
function out12(event:MouseEvent):void
{
fl_TF12.visible = false;
}
My end goal is to have the string that is displayed on the hover to display with the font Europa Regular. Is this because the string isn't targeted? Any help is greatly appreciated!
if you embedded correctly in the preferences, you should set embedFonts properties true
fl_TF12.embedFonts = true
also you can change your embedded font with this script
fl_TF12.font = Font.enumerateFonts()[0].fontName;

Codeigniter Auto completion is not working

Hello Auto completion is not working well in my application.When we type a name it displays only a blank list[ Screenshots attached ].
Controller Code
public function list_UserByName($letters)
{
if(strpos($letters, ","))
{
$letters1 = explode(",",$letters);
$lecount = count($letters1);
$letters = $letters1[$lecount-1];
}
$letters = preg_replace("/[^a-z0-9 ]/si","",$letters);
$response=$this->user_model->getAutoUserList($letters);
}
Model Code
public function getAutoUserList($letters)
{
$letters = preg_replace("/[^a-z0-9 ]/si","",$letters);
//AND user_type='C' AND user_status='A'
$query="select * from gm_users where uname Like '%$letters%'";
$result_query =$this->db->query($query);
foreach($result_query->result() as $result)
{
//echo "###".$result."|";
//$pinlevel =$this->functions->get_pinlevel($result->pinLevel);
//echo $result->userId."###".$result->uname." [ ".$pinlevel." ] "."|";
echo $result->userId."###".$result->uname."".$result->address." ".$result->city."|";
}
}
billing.php
<input type="text" autocomplete="off" size="20" name="txtname" id="txtname" onkeyup="ajax_showOptions(this,'getCountriesByLetters',event);" value=""/>
ajax-dynamic-list.js
/************************************************************************************************************
(C) www.dhtmlgoodies.com, April 2006
This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.
Thank you!
www.dhtmlgoodies.com
Alf Magne Kalleland
************************************************************************************************************/
var ajaxBox_offsetX = 25;
var ajaxBox_offsetY = 5;
var ajax_list_externalFile = site_url+'/catalog/list_UserByName'; // Path to external file
var minimumLettersBeforeLookup = 1; // Number of letters entered before a lookup is performed.
var ajax_list_objects = new Array();
var ajax_list_cachedLists = new Array();
var ajax_list_activeInput = false;
var ajax_list_activeItem;
var ajax_list_optionDivFirstItem = false;
var ajax_list_currentLetters = new Array();
var ajax_optionDiv = false;
var ajax_optionDiv_iframe = false;
var ajax_list_MSIE = false;
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)ajax_list_MSIE=true;
var currentListIndex = 0;
function ajax_getTopPos(inputObj)
{
var returnValue = inputObj.offsetTop;
while((inputObj = inputObj.offsetParent) != null){
returnValue += inputObj.offsetTop;
}
return returnValue;
}
function ajax_list_cancelEvent()
{
return false;
}
function ajax_getLeftPos(inputObj)
{
var returnValue = inputObj.offsetLeft;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
return returnValue;
}
// Edited
function ajax_option_setValue_bkp(e,inputObj)
{
if(!inputObj)inputObj=this;
var tmpValue = inputObj.innerHTML;
//alert(inputObj.id);
document.getElementById('saleUserId').value=inputObj.id;
if(ajax_list_MSIE)tmpValue = inputObj.innerText;else tmpValue = inputObj.textContent;
if(!tmpValue)tmpValue = inputObj.innerHTML;
val = ajax_list_activeInput.value.split(',');
vals = '';
count = val.length - 1;
for(i=0;i<count;i++)
{
vals = vals + val[i] + ',';
}
ajax_list_activeInput.value = vals + tmpValue;
if(document.getElementById(ajax_list_activeInput.name + '_hidden'))document.getElementById(ajax_list_activeInput.name + '_hidden').value = inputObj.id;
ajax_options_hide();
}
function ajax_option_setValue(e,inputObj)
{
if(!inputObj)inputObj=this;
var tmpValue = inputObj.innerHTML;
//alert(inputObj.id);
document.getElementById('saleUserId').value=inputObj.id;
if(ajax_list_MSIE)tmpValue = inputObj.innerText;else tmpValue = inputObj.textContent;
if(!tmpValue)tmpValue = inputObj.innerHTML;
ajax_list_activeInput.value = tmpValue;
if(document.getElementById(ajax_list_activeInput.name + '_hidden'))document.getElementById(ajax_list_activeInput.name + '_hidden').value = inputObj.id;
ajax_options_hide();
}
function ajax_options_hide()
{
if(ajax_optionDiv)ajax_optionDiv.style.display='none';
if(ajax_optionDiv_iframe)ajax_optionDiv_iframe.style.display='none';
}
function ajax_options_rollOverActiveItem(item,fromKeyBoard)
{
if(ajax_list_activeItem)ajax_list_activeItem.className='optionDiv';
item.className='optionDivSelected';
ajax_list_activeItem = item;
if(fromKeyBoard){
if(ajax_list_activeItem.offsetTop>ajax_optionDiv.offsetHeight){
ajax_optionDiv.scrollTop = ajax_list_activeItem.offsetTop - ajax_optionDiv.offsetHeight + ajax_list_activeItem.offsetHeight + 2 ;
}
if(ajax_list_activeItem.offsetTop<ajax_optionDiv.scrollTop)
{
ajax_optionDiv.scrollTop = 0;
}
}
}
function ajax_option_list_buildList(letters,paramToExternalFile)
{
ajax_optionDiv.innerHTML = '';
ajax_list_activeItem = false;
if(ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()].length<=1){
ajax_options_hide();
return;
}
ajax_list_optionDivFirstItem = false;
var optionsAdded = false;
for(var no=0;no<ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()].length;no++){
if(ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()][no].length==0)continue;
optionsAdded = true;
var div = document.createElement('DIV');
var items = ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()][no].split(/###/gi);
if(ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()].length==1 && ajax_list_activeInput.value == items[0]){
ajax_options_hide();
return;
}
div.innerHTML = items[items.length-1];
div.id = items[0];
div.className='optionDiv';
div.onmouseover = function(){ ajax_options_rollOverActiveItem(this,false) }
div.onclick = ajax_option_setValue;
if(!ajax_list_optionDivFirstItem)ajax_list_optionDivFirstItem = div;
ajax_optionDiv.appendChild(div);
}
if(optionsAdded){
ajax_optionDiv.style.display='block';
if(ajax_optionDiv_iframe)ajax_optionDiv_iframe.style.display='';
ajax_options_rollOverActiveItem(ajax_list_optionDivFirstItem,true);
}
}
function ajax_option_list_showContent(ajaxIndex,inputObj,paramToExternalFile,whichIndex)
{
if(whichIndex!=currentListIndex)return;
var letters = inputObj.value;
var content = ajax_list_objects[ajaxIndex].response;
var elements = content.split('|');
//alert(content);
ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()] = elements;
ajax_option_list_buildList(letters,paramToExternalFile);
}
function ajax_option_resize(inputObj)
{
ajax_optionDiv.style.top = (ajax_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 'px';
ajax_optionDiv.style.left = (ajax_getLeftPos(inputObj) + ajaxBox_offsetX) + 'px';
if(ajax_optionDiv_iframe){
ajax_optionDiv_iframe.style.left = ajax_optionDiv.style.left;
ajax_optionDiv_iframe.style.top = ajax_optionDiv.style.top;
}
}
function ajax_showOptions(inputObj,paramToExternalFile,e)
{
document.getElementById('saleUserId').value='';
if(e.keyCode==13 || e.keyCode==9)return;
if(ajax_list_currentLetters[inputObj.name]==inputObj.value)return;
if(!ajax_list_cachedLists[paramToExternalFile])ajax_list_cachedLists[paramToExternalFile] = new Array();
ajax_list_currentLetters[inputObj.name] = inputObj.value;
if(!ajax_optionDiv){
ajax_optionDiv = document.createElement('DIV');
ajax_optionDiv.id = 'ajax_listOfOptions';
document.body.appendChild(ajax_optionDiv);
if(ajax_list_MSIE){
ajax_optionDiv_iframe = document.createElement('IFRAME');
ajax_optionDiv_iframe.border='0';
ajax_optionDiv_iframe.style.width = ajax_optionDiv.clientWidth + 'px';
ajax_optionDiv_iframe.style.height = ajax_optionDiv.clientHeight + 'px';
ajax_optionDiv_iframe.id = 'ajax_listOfOptions_iframe';
document.body.appendChild(ajax_optionDiv_iframe);
}
var allInputs = document.getElementsByTagName('INPUT');
for(var no=0;no<allInputs.length;no++){
if(!allInputs[no].onkeyup)allInputs[no].onfocus = ajax_options_hide;
}
var allSelects = document.getElementsByTagName('SELECT');
for(var no=0;no<allSelects.length;no++){
allSelects[no].onfocus = ajax_options_hide;
}
var oldonkeydown=document.body.onkeydown;
if(typeof oldonkeydown!='function'){
document.body.onkeydown=ajax_option_keyNavigation;
}else{
document.body.onkeydown=function(){
oldonkeydown();
ajax_option_keyNavigation() ;}
}
var oldonresize=document.body.onresize;
if(typeof oldonresize!='function'){
document.body.onresize=function() {ajax_option_resize(inputObj); };
}else{
document.body.onresize=function(){oldonresize();
ajax_option_resize(inputObj) ;}
}
}
if(inputObj.value.length<minimumLettersBeforeLookup){
ajax_options_hide();
return;
}
ajax_optionDiv.style.top = (ajax_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 'px';
ajax_optionDiv.style.left = (ajax_getLeftPos(inputObj) + ajaxBox_offsetX) + 'px';
if(ajax_optionDiv_iframe){
ajax_optionDiv_iframe.style.left = ajax_optionDiv.style.left;
ajax_optionDiv_iframe.style.top = ajax_optionDiv.style.top;
}
ajax_list_activeInput = inputObj;
ajax_optionDiv.onselectstart = ajax_list_cancelEvent;
currentListIndex++;
if(ajax_list_cachedLists[paramToExternalFile][inputObj.value.toLowerCase()]){
ajax_option_list_buildList(inputObj.value,paramToExternalFile,currentListIndex);
}else{
var tmpIndex=currentListIndex/1;
ajax_optionDiv.innerHTML = '';
var ajaxIndex = ajax_list_objects.length;
ajax_list_objects[ajaxIndex] = new sack();
var search_key = inputObj.value.replace(" ","+");
//search_key1 = search_key.replace(",",",");
var url = ajax_list_externalFile + '/' +search_key;
ajax_list_objects[ajaxIndex].requestFile = url; // Specifying which file to get
ajax_list_objects[ajaxIndex].onCompletion = function(){ ajax_option_list_showContent(ajaxIndex,inputObj,paramToExternalFile,tmpIndex); }; // Specify function that will be executed after file has been found
ajax_list_objects[ajaxIndex].runAJAX(); // Execute AJAX function
}
}
function wordcount(string) {
var a = string.split(/\s+/g); // split the sentence into an array of words
return a.length;
}
function ajax_option_keyNavigation(e)
{
if(document.all)e = event;
if(!ajax_optionDiv)return;
if(ajax_optionDiv.style.display=='none')return;
if(e.keyCode==38){ // Up arrow
if(!ajax_list_activeItem)return;
if(ajax_list_activeItem && !ajax_list_activeItem.previousSibling)return;
ajax_options_rollOverActiveItem(ajax_list_activeItem.previousSibling,true);
}
if(e.keyCode==40){ // Down arrow
if(!ajax_list_activeItem){
ajax_options_rollOverActiveItem(ajax_list_optionDivFirstItem,true);
}else{
if(!ajax_list_activeItem.nextSibling)return;
ajax_options_rollOverActiveItem(ajax_list_activeItem.nextSibling,true);
}
}
/*if(e.keyCode==13 || e.keyCode==9){ // Enter key or tab key
if(ajax_list_activeItem && ajax_list_activeItem.className=='optionDivSelected')ajax_option_setValue(false,ajax_list_activeItem);
if(e.keyCode==13)return false; else return true;
}
if(e.keyCode==27){ // Escape key
ajax_options_hide();
}*/
}
//document.documentElement.onclick = autoHideList;
function autoHideList(e)
{
if(document.all)e = event;
if (e.target) source = e.target;
else if (e.srcElement) source = e.srcElement;
if (source.nodeType == 3) // defeat Safari bug
source = source.parentNode;
if(source.tagName.toLowerCase()!='input' && source.tagName.toLowerCase()!='textarea')ajax_options_hide();
}
Am a beginner in php as well as Codeigniter
Just echo your data in your controller
change
$response=$this->user_model->getAutoUserList($letters);
To
echo $this->user_model->getAutoUserList($letters);
change
onkeyup="ajax_showOptions(this,'getCountriesByLetters',event);
to
onkeyup="ajax_showOptions(this,'list_UserByName',event);
there is a question on this topic on stackoverflow, but an entire different process.
My Codeigniter autocomplete with ajax

How to disable button from being clicked before a function has finished in javascript

Okay, so I have a button without any Id but when it is clicked it starts a function called buttonClick. This function basically controls a slot machine(poke machine) it's images, winnings etc. Note, some code may not work but please disregard this and imagine it working. But how can I make it so that if the user clicks the play button before this function is finished it won't do anything but will still finish the function it's already doing? Sorry for the inconvenience of not having my full length code in here, but a sample of it.
function buttonClick(){
var pic = new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg");
var ex1 = pic[Math.floor(Math.random()*pic.length];
var ex2 = pic[Math.floor(Math.random()*pic.length];
var ex3 = pic[Math.floor(Math.random()*pic.length];
var moveImg = new Array("1.gif","2.gif","3.gif");
var timer = new Array("1000","5000","500","2000");
var time = Math.floor(Math.random()*4);
if (document.getElementById('coins').value > 0){
document.getElementById('coins').value -= 1;
pic[0].src = moveImg[0];
pic[1].src = moveImg[1];
pic[2].src = moveImg[2];
setTimeout(function(){
pic[0].src = ex1;
pic[1].src = ex2;
pic[2].src = ex3;
},timer[time])
}
else{
alert('Error insufficient tokens');
}
}
var in_progress = false;
function buttonClick(){
if(!in_progress){
var pic = new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg");
var ex1 = pic[Math.floor(Math.random()*pic.length];
var ex2 = pic[Math.floor(Math.random()*pic.length];
var ex3 = pic[Math.floor(Math.random()*pic.length];
var moveImg = new Array("1.gif","2.gif","3.gif");
var timer = new Array("1000","5000","500","2000");
var time = Math.floor(Math.random()*4);
if (document.getElementById('coins').value > 0){
in_progress = true;
document.getElementById('coins').value -= 1;
pic[0].src = moveImg[0];
pic[1].src = moveImg[1];
pic[2].src = moveImg[2];
setTimeout(function(){
in_progress = false;
pic[0].src = ex1;
pic[1].src = ex2;
pic[2].src = ex3;
},timer[time])
} else {
alert('Error insufficient tokens');
}
}
}
alternatively you can wrap the function in a closure to make the in_progress a private variable.
var buttonClick = (function(){
var in_progress = false;
return function(){
if(!in_progress){
var pic = new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg");
var ex1 = pic[Math.floor(Math.random()*pic.length];
var ex2 = pic[Math.floor(Math.random()*pic.length];
var ex3 = pic[Math.floor(Math.random()*pic.length];
var moveImg = new Array("1.gif","2.gif","3.gif");
var timer = new Array("1000","5000","500","2000");
var time = Math.floor(Math.random()*4);
if (document.getElementById('coins').value > 0){
in_progress = true;
document.getElementById('coins').value -= 1;
pic[0].src = moveImg[0];
pic[1].src = moveImg[1];
pic[2].src = moveImg[2];
setTimeout(function(){
in_progress = false;
pic[0].src = ex1;
pic[1].src = ex2;
pic[2].src = ex3;
},timer[time])
} else {
alert('Error insufficient tokens');
}
}
};
})();

Categories