var unityInstance ;
var hidden = false;
var loaded = false;
var uniLoaded = false;
var mdivid = 1;
var waitingText = "رجاء ضع المؤشر فوق النص لقراءته";
function initMadaSLAVTR(){
initMadaSLAVTR(borderColor=0, fillColor=0)
}
function initMadaSLAVTR(borderColor=0, fillColor=0){
jQuery(document).ready(function ($) {
if(fillColor!=0){
$(".egosltext").css("background", "red");
$(".egosltext").css("background", "black");
$(".btn-floating").css("background-color", "red");
}
$("body").append('');
$("body").append('');
/*
$("body").append('');
$("body").append('');
*/
$.getScript("https://jumlaapi.mada.org.qa/TemplateData/UnityProgress.js", function(){
$.getScript("https://jumlaapi.mada.org.qa/Build/UnityLoader.js", function(){
});
});
$("body").append('');
$("body").append('
مترجم لغة الإشارة القطرية -بو حمد-
رجاء ضع المؤشر فوق النص لقراءته
');
});
}
function initMadaFramedSLAVTR(){
jQuery(document).ready(function ($) {
$("body").append('');
$("body").append('');
$.getScript("https://jumlaapi.mada.org.qa/TemplateData/UnityProgress.js", function(){
$.getScript("https://jumlaapi.mada.org.qa/Build/UnityLoader.js", function(){
unityInstance = UnityLoader.instantiate("SLContainer", "https://jumlaapi.mada.org.qa/Build/BuHamadPlayer.json", {onProgress: UnityProgress});
});
});
$("body").append('');
$("#madaAvtarDiv").append('');
});
}
onEndSPlayEent = function(txt){
}
function SLUpdateText(txt){
if(txt[0]=='_')txt =" - ";
txt = txt.split("/#/")
//console.log(txt.length)
document.getElementById("egosltext").innerHTML = cutString(txt[0],40);
//if(txt.length>1)console.log(txt[1])
onEndSPlayEent(txt[0]);
}
/*
window.onload = function() {
jQuery(document).ready(function ($) {
// Your code here
$('*').mouseover(
function() {
alert("ok");
}
);
});
}
*/
function setSLwidth(){
sz = document.getElementById("avtrrange").value;
document.getElementById("SLContainer").style.width = sz+"px";
document.getElementById("SLContainer").style.height = sz*1.3+"px";
zm = sz/300;
document.getElementById("egosltext").style.zoom = zm;
document.getElementById("egobuhamadtext").style.zoom = zm;
document.getElementById("egobuhamadtext").style.bottom = (37+sz*0.0006)+"px"
//document.getElementById("SLContainer").style.height = document.getElementById("avtrrange").value;
}
function cutString(s, n){
var cut= s.indexOf(' ', n);
if(cut== -1) return s;
return s.substring(0, cut)
}
function initSelectablePage(){
jQuery(document).ready(function ($) {
$("*:not('script, style, noscript')").filter(function() {
//if(this.textContent == undefined) return false;
a = $(this).clone().children().remove().end().text().trim();
ctntxt = a;
tid = $(this).attr("id");
if(a.length !== 0 && tid != "egosltext" && tid != "egobuhamadtext"){
//console.log(" -- txt = "+a);
return true;
}
return false;
}).wrap(function() {return "";});
});
}
var scheduler = null;
var updateText = false;
function schedulePlaySign(str,elemnt){
if(document.getElementById("egosltext").innerHTML == waitingText){
updateText = true;
SLUpdateText("جاري العمل على الترجمة")
}
scheduler = setTimeout(function(){playEGOSign(str)},1500);
}
function stopPlaySentence(){
if(updateText)
SLUpdateText(waitingText)
clearTimeout(scheduler);
}
function loadAvatar(){
//alert("ok");
document.getElementById("SLContainer").style.display = "block";
document.getElementById("egops").style.display = "block";
//document.getElementById("egortav").style.display = "block";
document.getElementById("egozoom").style.display = "block";
document.getElementById("egosltext").style.display = "block";
document.getElementById("egobuhamadtext").style.display = "block";
//document.getElementById("egoload").style.display = "none";
unityInstance = UnityLoader.instantiate("SLContainer", "https://jumlaapi.mada.org.qa/Build/BuHamadPlayer.json", {onProgress: UnityProgress});
hidden = false;
loaded = true;
initSelectablePage();
}
function changeVisibility(){
if(!loaded)loadAvatar()
else if(hidden)showAvatar();
else hideAvatar();
}
function hideAvatar(){
document.getElementById("SLContainer").style.display = "none";
document.getElementById("egops").style.display = "none";
//document.getElementById("egortav").style.display = "none";
document.getElementById("egozoom").style.display = "none";
document.getElementById("egosltext").style.display = "none";
document.getElementById("egobuhamadtext").style.display = "none";
//document.getElementById("egoload").style.display = "block";
hidden = true;
}
function showAvatar(){
document.getElementById("SLContainer").style.display = "block";
document.getElementById("egops").style.display = "block";
//document.getElementById("egortav").style.display = "block";
document.getElementById("egozoom").style.display = "block";
document.getElementById("egosltext").style.display = "block";
document.getElementById("egobuhamadtext").style.display = "block";
//document.getElementById("egoload").style.display = "none";
hidden = false;
}
var firstplay = true;
function playMADASL(str){
playEGOSign(str);
}
function playEGOSign(str){
if(uniLoaded){
updateText = false;
if(firstplay){firstplay=false;initAvatar();}
unityInstance.SendMessage("MvnActors","playEGOSign",str);
}
}
function rotateMADAAvatar(rx){
rotateEGOAvatar(rx)
}
function rotateEGOAvatar(rx){
if(uniLoaded){
unityInstance.SendMessage("MvnActors","rotateEGOAvatar",rx);
}
}
function initAvatar(){
if(uniLoaded){
unityInstance.SendMessage("MvnActors","setIpServer","jumlaslwp.mada.org.qa");
//alert("169.254.129.2");
}
}
function SLonSceneLoaded(){
uniLoaded = true;
}