function appbgf(lood)
{
htmlapp='';
if(app.FileExists('/Sys/htmlapp/app/index.html')) {
htmlapp="file:///Sys/htmlapp/app/index.html?aurltma=";
}else{
htmlapp='';
}
return htmlapp + lood;
}
function apphhfff(lood)
{
htmlapp='';
if(app.FileExists('/Sys/htmlapp/lohtml.html')) {
htmlapp="file:///Sys/htmlapp/lohtml.html?aurltma=";
}else{
htmlapp='';
}
return htmlapp + lood;
}
//webostma--------------------
var file = "demofileurl1";
function webostma()
{
var valuetma = app.LoadText( "valueurl", "https://t-ma.ir", file );
app.ShowTextDialog( "آدرس سایت حدف:", valuetma , OnInputName );
}
function OnInputName( name )
{
titurl='';
app.SaveText( "valueurl",name , file );
dlg = app.CreateDialog('','NoCancel')
dlg.SetTitleColor( "#00796B" );
dlg.SetBackColor( "#ffffff", 5 );
//Create a layout for dialog.
layDlg = app.CreateLayout( "linear" )
layDlg.SetMargins( 0,0,0,0.01 );
dlg.AddLayout( layDlg );
//-------------------------
// app.ShowPopup( "Your name is " + name );
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" )
//Create a web control.
webtmaappos = app.CreateWebView( 0.98, 0.85 ,'IgnoreErrors')
////////////////////////
function ontop(){
/*
webtmaappos.Execute('const collection = document.getElementsByClassName("notice-success");');
webtopup.Execute('collection[0].style.display = "none";');
webtmaappos.Execute('const collection = document.getElementsByClassName("notice");');
webtopup.Execute('collection[0].style.display = "none";');
webtmaappos.Execute('document.getElementById("publish").style.position = "fixed";');
webtmaappos.Execute('document.getElementById("publish").style.top = "1%";');
webtmaappos.Execute('document.getElementById("publish").style.left = "10%";');
webtmaappos.Execute('document.getElementById("save-action").style.position = "fixed";');
webtmaappos.Execute('document.getElementById("save-action").style.top = "1%";');
*/
}
webtmaappos.SetOnTouch( ontop );
//////////////////////
webtmaappos.LoadUrl(apphhfff(name));
webtmaappos.SetOnProgress( web_OnProgesstma )
function ontsaveoder( progress )
{
app.SaveText( "valueurl",webtmaappos.GetUrl() , file );
}
webtmaappos.SetOnTouch( ontsaveoder );
lay.AddChild( webtmaappos )
//Create horizontal sub-layout for buttons.
layHoriz = app.CreateLayout( "linear", "Horizontal" )
//Create Local button.
btnback = app.CreateButton( "🔙" ,-1,-1,'Custom,HTML')
btnback.SetTextSize( 10 )
function btnback_OnTouch()
{
webtmaappos.Back();
}
btnback.SetOnTouch( btnback_OnTouch )
layHoriz.AddChild( btnback )
//Create Dynamic button.
btnref = app.CreateButton( "🔄" )
function btnref_OnTouch()
{
webtmaappos.Reload();
}
btnref.SetOnTouch( btnref_OnTouch )
layHoriz.AddChild( btnref )
//Create Remote button.
btnfw = app.CreateButton( "➡️" )
function btnfw_OnTouch()
{
webtmaappos.Forward();
}
btnfw.SetOnTouch( btnfw_OnTouch )
layHoriz.AddChild( btnfw )
btnurl = app.CreateButton( "🌐" )
function btnurl_OnTouch()
{
function OnName2( name )
{
webtmaappos.LoadUrl(name);
}
app.ShowTextDialog( "آدرس سایت حدف:",webtmaappos.GetUrl(), OnName2 );
}
btnurl.SetOnTouch( btnurl_OnTouch )
layHoriz.AddChild( btnurl )
btnmin = app.CreateButton( "❌" )
function btnmin_OnTouch()
{
dlg.Dismiss();
}
btnmin.SetOnTouch( btnmin_OnTouch )
layHoriz.AddChild( btnmin )
btnourl = app.CreateButton( "📤" )
function btnourl_OnTouch()
{
app.OpenUrl(webtmaappos.GetUrl(),'text/html','application/x-www-form-urlencoded');
}
btnourl.SetOnTouch( btnourl_OnTouch )
layHoriz.AddChild( btnourl )
//Add horizontal layout to main layout.
lay.AddChild( layHoriz )
//Add layout to app.
//Called when user touches Local button.
//(We could use a url like "file:///sdcard/MyPage.htm")
function btnLocal_OnTouch()
{
webtmaappos.LoadUrl( "file:///Sys/Html/Page.htm" )
}
//Called when user touches Dynamic button.
function btnDynamic_OnTouch()
{
var html = "
";
html += "";
html += "Hello Dynamic World!
";
html += "";
html += "";
webtmaappos.LoadHtml( html, "file:///Sys/" )
}
//Called when user touches Remote button.
function btnRemote_OnTouch()
{
app.ShowProgress("Loading...")
webtmaappos.LoadUrl( "http://www.bbc.co.uk" )
}
//Show page load progress.
function web_OnProgesstma( progress )
{
app.Debug( "progress = " + progress )
if( progress==100 ) {
app.HideProgress()
titurl=webtmaappos.GetUrl()+'-'+webtmaappos.GetTitle();
app.SaveText( "valueurl",webtmaappos.GetUrl() , file );
}
}
layDlg.AddChild( lay );
//-------------------------
//Create a list control.
//Show dialog.
dlg.Show()
}
//--------------
function OnInputName02( name )
{
titurl='';
//app.SaveText( "valueurl",name , file );
dlg = app.CreateDialog('','')
dlg.SetTitleColor( "#00796B" );
dlg.SetBackColor( "#ffffff", 5 );
//Create a layout for dialog.
layDlg = app.CreateLayout( "linear" )
layDlg.SetMargins( 0,0,0,0.01 );
dlg.AddLayout( layDlg );
//-------------------------
// app.ShowPopup( "Your name is " + name );
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" )
//Create a web control.
webtmaappos = app.CreateWebView( 0.98, 0.85 ,'IgnoreErrors')
webtmaappos.LoadUrl(apphhfff(name));
webtmaappos.SetOnProgress( web_OnProgesstma )
function ontsaveoder( progress )
{
//app.SaveText( "valueurl",webtmaappos.GetUrl() , file );
}
webtmaappos.SetOnTouch( ontsaveoder );
lay.AddChild( webtmaappos )
//Create horizontal sub-layout for buttons.
layHoriz = app.CreateLayout( "linear", "Horizontal" )
//Create Local button.
btnback = app.CreateButton( "🔙" ,-1,-1,'Custom,HTML')
btnback.SetTextSize( 10 )
function btnback_OnTouch()
{
webtmaappos.Back();
}
btnback.SetOnTouch( btnback_OnTouch )
layHoriz.AddChild( btnback )
//Create Dynamic button.
btnref = app.CreateButton( "🔄" )
function btnref_OnTouch()
{
webtmaappos.Reload();
}
btnref.SetOnTouch( btnref_OnTouch )
layHoriz.AddChild( btnref )
//Create Remote button.
btnfw = app.CreateButton( "p" )
//
function html2Text( html )
{
var tagRegexp;
// the following tags will be removed, but their contents will be maintained
var tags_unwrap = [ 'a', 'b', 'span', 'i', 'em', 'u', 'strong', 'sup', 'center', 'font' ];
// the following tags will be stripped, as well as their contents
var tags_strip = [ 'iframe', 'img', 'script', 'style', 'link', 'object', 'embed', 'table' ];
// the following tags will include white space below
var tags_block_level = [ 'p', 'blockquote', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' , 'iframe', 'img', 'script', 'style', 'link', 'object', 'embed', 'table' , 'a', 'b', 'span', 'i', 'em', 'u', 'strong', 'sup', 'center', 'font' ];
html = html.replace(/]*>/g,"");
html = html.replace(/]*>/g,"");
html = html.replace(/
]*>/g,"");
html = html.replace(/';
////////////////////
dlg = app.CreateDialog( );
layDlg = app.CreateLayout( "linear", "VCenter,FillXY" );
layDlg.SetSize( 1, 0.85 );
dlg.AddLayout( layDlg );
/*
chk = app.CreateCheckBox( "Check Box" );
chk.SetMargins( 0, 0.02, 0, 0.02 );
layDlg.AddChild( chk );
btnDlg = app.CreateButton( "Close Dialog", 0.6, 0.1 );
btnDlg.SetOnTouch( btnDlg_OnTouch );
layDlg.AddChild( btnDlg );
*/
web = app.CreateWebView( 0.9, 0.8,"IgnoreErrors,NoScrollBars");
web.SetBackColor( "#FFFFFF" );
layDlg.AddChild( web );
traslate="
\r\n\r\n";
web.LoadHtml( head+data+''+fot+'', "file:///Sys/" );
//dlg.Dismiss();
// alert(head+traslate+data+''+fot+'
');
dlg.Show();
//////////////////
}
function newsapp(appurlnewsapp){
B=jsondata(appurlnewsapp+'/wp-json/wp/v2/posts');
cont=0;
var list = []
var list0 = '';
function myFunction(value) {
// txt += value + "
";
if (isJson(value)){
}else{
cont=cont+1;
list.push({name:''+value.title.rendered,link:''+value.link,content:''+value.content.rendered});
list0=list0+','+value.title.rendered;
//value.title.rendered
//jsonweb(value.title.rendered);
}
}
if(app.LoadText(appurlnewsapp+'/wp-json/wp/v2/posts','')==""){
app.ShowPopup('درحال بروزرسانی');
}else{
B.forEach(myFunction);
}
// lsd = app.CreateListDialog("", list,0.9,0.8)
// lsd.SetOnSelect(OnTouchnews)
lsd = app.CreateListDialog( "", list0 );
lsd.SetOnTouch( OnTouchnews );
function OnTouchnews(n,y)
{
//app.ShowPopup(y)
//
// pageurlwebpage=appurlnewsapp+n;
findindex=-1;
if(n!=''&& n!=null){
////////////////++
for (let i = 0; i < B.length; i++) {
if(B[i].title.rendered==n)
{
findindex=i;
pageurlwebpage=B[i].link;
}
}
if(appline!='offline'){
OnInputName02(pageurlwebpage);
}else{
if(findindex!=-1){
app.ShowPopup('نمای آفلاین');
jsonweb(B[findindex].content.rendered);
}
}
////////////////////++
}
/*
//jsonweb(B[y].content.rendered);
if(appline!='offline'){
pageurlwebpage=n;
OnInputName02(pageurlwebpage);
}else{
app.ShowPopup('نمای آفلاین');
jsonweb(B[y].content.rendered);
}
*/
}
lsd.Show()
//alert(cont);
}
//Called when user touches our button.
function newstma()
{
//Create dialog window.
dlg = app.CreateDialog( "Choose a Fruit" )
dlg.SetTitleColor( "#00796B" )
dlg.SetBackColor( "#ffffff", 5 )
//Create a layout for dialog.
layDlg = app.CreateLayout( "linear", "vertical,fillxy,left" )
layDlg.SetMargins( 0,0,0,0.01 )
dlg.AddLayout( layDlg )
//Create a list control.
var list = "";
list=list+'';list=list+'t-ma.ir,';
list=list+'';list=list+'clarotm.ir,';
list=list+'';list=list+'iseokar.ir';
lst = app.CreateList( list, 0.8, 0.35 )
lst.SetTextColor( "#222222" );
//Handle list item selection.
function news_OnTouch( item )
{
//Hide the dialog window.
dlg.Hide()
newsapp('https://'+item+ '/');
}
lst.SetOnTouch( news_OnTouch )
layDlg.AddChild( lst )
//Show dialog.
dlg.Show()
}
lod="file:///android_asset/htmlapp/lo.html";
dlgbg = app.CreateDialog( );
function bgload(lo)
{
layDlg = app.CreateLayout( "linear", "VCenter,FillXY" );
layDlg.SetSize( 1, 1 );
web = app.CreateWebView( 1, 1 );
web.SetBackColor( "#00000000" );
web.LoadUrl( lo);
dlgbg.AddLayout( layDlg );
layDlg.AddChild( web );
dlgbg.Show();
}
function findstrft(n,text){
position = text.search(n);
r=false;
if(position>-1){
r=true;
}
//alert(r);
return r;
}
agenttma='app:Androidtmaapp v2';
app.SetScreenMode( "Game" );
//Get app name and path.
appName = app.GetName();
appPath = "/sdcard/" + appName;
//---------------
var version = app.GetVersion();
/*
if(version!="3.55"){
atmp='لطفا برنامه را بروز کنید';
app.Alert( version, atmp +"App Version:" );
}
*/
//--------------
app.MakeFolder(appPath);
model = app.GetModel();
if(model=='JNY-LX1'){
app.ShowPopup( "سلام مدیر" );
//appai('سلام+مدیر+.خوش+آمدی');
}
///-----------------------------------------------
var path = app.GetAppPath();
app.ExtractAssets( "plugs", path+"/plugins", true );
app.SetOnError( OnError );
//-----------------------------------
_LoadPlugin2 = function( name )
{
if( !name ) return;
var privDir = app.GetPrivateFolder( "Plugins" );
var privDir = app.GetAppPath("Plugins");
var url = privDir+"/"+name.toLowerCase()+"/"+name+".inc"
if( !app.FileExists(url) ) url = privDir+"/"+name.toLowerCase()+"/"+name+".js"
_LoadScriptSync( url );
//app.Alert( url );
}
//-----------------------------------
//var path = app.GetAppPath();
// app.Alert( path );
//app.LoadPlugin( 'CustomTabs' );
//app.CreateCustomTabs2 = function() { _LoadPlugin2( "CustomTabs"); return new CustomTabsWrapperClass() }
function OnError( msg, line, file )
{
var text =
'Message: "' + msg + '"\n' +
'Line: ' + line + '\n' +
'File: "' + app.Uri2Path(file) + '"';
if(model=='JNY-LX1'){
app.Alert( text, "Received error message:" );
}
Eror=" مشکلی پیش امد کد ارور ";
Msg='لطفا این ارور را به ما اعلام فرمایید';
app.ShowPopup(Eror +'\nL E:'+ line + Msg);
}
///////
app.SetOrientation( "Portrait" );
var storeUrl = "/Sys/Img/Offline.png";
//file:///android_asset/htmlapp/off/index.html
newstoreurl='file:///android_asset/htmlapp/off/index.html';
if(app.FileExists('/Sys/htmlapp/off/index.html')) {
app.ShowPopup("myFile exists!");
storeUrl = newstoreurl;
//bgload("file:///android_asset/htmlapp/lo.html" );
} else {
//app.ShowPopup("myFile does not exist!");
}
var appback=3;
var appbacktit='بزنید تا بتوانید خارج شوید';
var msgnewtma='پیام جدید در نرم افزار تیما دارید';
var msglogout='درحال خروج از حساب کاربری';
appline='offline';
appPause=0;
var appstart=0;
app.EnableBackKey( false );
skb = app.CreateSeekBar( 0.8 );
// btnE.SetTextSize( 30, 'ps' );
btniconsize=60;
btniconop='ps';
btnmode='Alum';
webhome="file:///Sys/htmlapp/home0.html";
webhome=apphhfff("https://t-ma.ir/page-app");
//https://accounts.pod.ir/oauth2/authorize/?scope=profile_nickname&response_type=code&redirect_uri=https%3A%2F%2Ft-ma.ir%2Fapp%2Fhome%2F&client_id=20757781wdd414dc58dc55d1531dc54d4
webhome="https://accounts.pod.ir/oauth2/authorize/?scope=profile_nickname+email+profile&response_type=code&redirect_uri=https%3A%2F%2Ft-ma.ir%2Fapp%2Fhome%2F&client_id=20757781wdd414dc58dc55d1531dc54d4";
webhome='https://accounts.pod.ir/oauth2/authorize/index.html?client_id=20757781wdd414dc58dc55d1531dc54d4&response_type=code&redirect_uri=https://t-ma.ir/page-app/';
var file = "podlogin";
value = app.LoadText( file, "", file );
if(value=="Async is ready."){
webhome="file:///Sys/htmlapp/home0.html";
webhome=apphhfff("https://t-ma.ir/page-app");
}
talkweb='https://accounts.pod.ir/oauth2/authorize/index.html?client_id=20757781wdd414dc58dc55d1531dc54d4&response_type=code&redirect_uri=https://talk.pod.ir/';
miniproxy='https://raspe.id.au/bypass/miniProxy.php';
pod="pod.ir";
spaceurl='space.pod.ir';
spaceweb=apphhfff('https://space.pod.ir/');
topupweb='https://topup.pec.ir/?mid=24591';
webfaktor='https://t-ma.ir/app/home/i/index.php';
layapp = app.CreateLayout( "linear", "VCenter,FillXY" );
layFooter = app.CreateLayout("Linear","Horizontal");
layFooter.SetPosition(0,0.88,1,0.03);
layFooter.SetBackColor("#dddddd");
webpage = app.CreateWebView( 1, 0.95, "IgnoreErrors,NoScrollBars" );
// webpage.SetOnUrl( web_hOnUrl );
function web_hOnUrl( urlq )
{
if(urlq=="https://t-ma.ir" || urlq=="https://t-ma.ir/" || urlq=="http://t-ma.ir"){
webpage.LoadUrl( lod);
webpage.LoadUrl( webhome );
}
}
webtalk = app.CreateWebView( 1, 0.95, "IgnoreErrors,NoScrollBars" );
webspace = app.CreateWebView( 1, 0.95, "IgnoreErrors,NoScrollBars" );
webtopup = app.CreateWebView( 1, 0.95, "IgnoreErrors,NoScrollBars" );
function talkb(){
if(webtalk.CanGoBack() || webspace.CanGoBack() || webtopup.CanGoBack() ){
webtalk.Back();
webspace.Back();
if(webtopup.CanGoBack()){
webtopup.Back();
webtopup_OnComplete();
}
}else{
dlgtalk.Dismiss();
dlgtopup.Dismiss();
dlgspace.Dismiss();
}
}
function web_OnUrl( urlq )
{
a=urlq;
// if(a.search(pod)==-1 && a.search('accounts.pod.ir')!=-1){
//accounts
app.OpenUrl(urlq);
//webtalk.Back();
webtalk.LoadUrl( talkweb );
//}
// webtalk.Execute('var alertahtmlold=document.getElementById("app").innerHTML;function timertma(){document.getElementById("app").innerHTML!=alertahtmlold&&(alertahtmlold=document.getElementById("app").inneHrTML,new Audio("https://t-ma.ir/app/home/assets/asms.mp3").play(),console.log("new message tma")),setTimeout(timertma,3e3)}timertma();');
}
//-----------------------------------------------start
webtalk.SetOnProgress( web_OnProgess );
//web_OnUrl
//webtalk.SetOnUrl( web_OnUrl );
webtalk.SetOnConsole( callbtma );
webtalk.SetOnTouch( ontaudio );
function OnPause()
{
app.ShowPopup( "OnPause" )
ontaudio();
}
function OnResume()
{
app.ShowPopup( "OnResume" )
webtalk.Execute('apppuse='+appstart+';');
}
function ontaudio(){
// webtalk.Execute('apppuse='+appstart+';');
if(appstart==0){
appstart=1;
tmpa="\r\nvar alertahtmlold=document.getElementsByClassName(\"_2wJ2R\")[0].innerHTML;\r\n\r\n\r\nfunction timertma() {\r\nlet tak = alertahtmlold.search(\'تاک\');\r\nif(tak>0 ){\r\n console.log(\"talk tak\");\r\n\r\n}\r\nif(document.getElementsByClassName(\"_2wJ2R\")[0].innerHTML!=alertahtmlold){\r\nalertahtmlold=document.getElementsByClassName(\"_2wJ2R\")[0].innerHTML;\r\nlet position = alertahtmlold.search(\'
1
\');\r\nlet position2 = alertahtmlold.search(\'2
\');\r\nlet position3 = alertahtmlold.search(\'3
\');\r\nlet position4 = alertahtmlold.search(\'4
\');\r\nlet position5 = alertahtmlold.search(\'5
\');\r\n\r\nlet position00 = alertahtmlold.search(\'id=\"message-\');\r\nif(position00>0 ){\r\n}else{\r\nif(position>0 || position2>0 || position3>0 || position4>0 || position5>0 ){\r\nvar audio = new Audio(\"https://t-ma.ir/app/home/assets/asms.mp3\");\r\n audio.play();\r\n // alert();\r\n console.log(\"new message tma\");\r\n}\r\n}\r\n\r\n}\r\n setTimeout(timertma, 3000);\r\n}\r\n timertma();\r\n \r\n \r\n ";
webtalk.Execute(tmpa);
}
}
dlgtalk = app.CreateDialog( '','NoTitle,NoDim,NoCancel' );
dlgtalk.SetOnBack(talkb);
webtalk.LoadUrl( talkweb );
layDlgtalk = app.CreateLayout( "linear", "Vertical,FillXY" );
layDlgtalk.SetSize( 1, 1 );
dlgtalk.AddLayout( layDlgtalk );
layDlgtalk.SetBackColor("#071024");
webtalk.SetSize(1,1);
/////////////////////////////
layDlgtalk.AddChild( webtalk );
//---------------------
app.SetOnShowKeyboard( OnKeyboardShow );
function OnKeyboardShow()
{
var height = app.GetKeyboardHeight();
// txt.SetText( "Keyboard Height: " + height + "px" );
keyapp="0.4"+height;
if(height==0){
webpage.SetSize(1,0.89);
webtalk.SetSize(1,0.89);
webspace.SetSize(1,0.89);
webtopup.SetSize(1,0.89);
layDlgtalk.SetSize( 1, 0.9);
}else{
layDlgtalk.SetSize( 1, 0.9);
webtalk.SetSize(1,1-Number(keyapp));
webspace.SetSize(1,1-Number(keyapp));
webtopup.SetSize(1,1-Number(keyapp));
webpage.SetSize(1,1-Number(keyapp));
}
}
//------------
dlgtalk.Show();
dlgtalk.Dismiss();
//-----------------------------------------------start
webspace.SetOnProgress( web_OnProgess );
webspace.SetOnConsole( callbtma );
webspace.Execute('var connected = navigator.onLine;if(connected==false){location.replace("#offLine");}');
dlgspace = app.CreateDialog( '','NoTitle,NoDim,NoCancel' );
webspace.LoadUrl( spaceweb );
layDlgspace = app.CreateLayout( "linear", "VCenter,FillXY,AutoCancel,NoCancel" );
layDlgspace.SetSize( 1, 1);
dlgspace.SetOnBack(talkb);
dlgspace.AddLayout( layDlgspace );
/////////////////////////////
layDlgspace.AddChild( webspace );
//------------
dlgspace.Show();
dlgspace.Dismiss();
//--------------------------end--------------------------------------------
dlgtopup = app.CreateDialog( '','NoTitle,NoDim,NoCancel' );
webtopup.LoadUrl( topupweb );
webtopup.SetOnProgress( web_OnProgess );
function webtopup_OnComplete(){
webtopup.Execute('document.getElementById("footer").style.display = "none";');
webtopup.Execute('const collection = document.getElementsByClassName("navbar-default navbar-fixed-top");');
webtopup.Execute('collection[0].style.display = "none";');
}
webtopup.SetOnTouch( webtopup_OnComplete );
//webtopup.SetOnConsole( callbtma );
layDlgtopup = app.CreateLayout( "linear", "VCenter,FillXY,AutoCancel,NoCancel" );
layDlgtopup.SetSize( 1, 1);
dlgtopup.SetOnBack(talkb);
layDlgtopup.AddChild( webtopup );
dlgtopup.AddLayout( layDlgtopup );
/////////////////////////////
//------------
dlgtopup.Show();
dlgtopup.Dismiss();
//-----------------------------------------------
function Exitp(){
if(appback==1){
app.Exit();
}else{
appback=appback-1;
if(appback<2){
app.ShowPopup(appback+appbacktit);
}
}
}
function OnBack() {
if(webpage.CanGoBack() ){
webpage.Back();
}else{
// laypage.Animate("SlideToBottom")
webpage.Stop()
Exitp();
}
app.Wait(0.5);
}
function talkapp(){
app.ShowPopup('test');
}
function callbtma(msg){
//app.ShowPopup( model );
if(model=='JNY-LX1'){
app.ShowPopup(msg);
}
if(msg!=""){
if(msg=="Async is ready."){
var file = "podlogin";
app.SaveText( file, msg, file );
app.ShowPopup( "Value Saved." );
//webtalk.LoadUrl( talkweb );
}
if(findstrft("talk tak",msg) || findstrft("new message tma",msg)){
webtalk.SetOnUrl( web_OnUrl );
}
if(findstrft("show more",msg)){
btnmore_OnTouch();
}
if(findstrft("show web-os",msg)){
webostma();
}
if(findstrft("show ai11",msg)){
Speechapp();
}
if(findstrft("show ai12",msg)){
//Speechapp();
webpage.LoadUrl( 'https://t-ma.ir/tchat/?01' );
}
if(findstrft("show tick",msg)){
//Speechapp();
webpage.LoadUrl( 'https://t-ma.ir/panel/?endp=nirweb-ticket' );
}
if(findstrft("show nw t-ma.ir",msg)){
newsapp('https://t-ma.ir/');
}
if(findstrft("chatgtp-tma:",msg)){
tmpmsg=msg;
tmpmsg =tmpmsg.replace("chatgtp-tma:", "");
appai(tmpmsg);
}
if(findstrft("show nw clarotmir",msg)){
newsapp('https://clarotm.ir/');
}
if(findstrft("show news",msg)){
newstma();
//newsapp('https://clarotm.ir/');
}
position=msg.search("videotma")
if(position>-1){
tmpmsg=msg;
tmpmsg =tmpmsg.replace("videotma", "");
//app.Alert("https://t-ma.ir/app/vid/vidtma/"+tmpmsg +".mp4")
onvdeios("https://t-ma.ir/app/vid/vidtma/"+tmpmsg +".mp4");
}
//skb.SetValue( 50 );
if(findstrft("show tma faktor",msg)){
//webpage.LoadUrl( webfaktor );
serverpc();
}
if(findstrft("tmaback",msg)){
var file = "podlogin";
app.SaveText( file, '', file );
app.ShowPopup(msglogout);
}
if(findstrft("show app home",msg)){
webpage.LoadUrl( lod);
webpage.LoadUrl( webhome );
}
if(findstrft("show team",msg))
{
webtimego='https://podform.ir/f/iAOCBsl-sadQKERp0zuu1A==';
webpage.LoadUrl( webtimego );
}
if(findstrft("show talk",msg)){
//ontaudio();
/*
webtopup.Execute('document.getElementById("footer").style.display = "none";');
webtopup.Execute('const collection = document.getElementsByClassName("navbar-default navbar-fixed-top");');
webtopup.Execute('collection[0].style.display = "none";');
*/
/*
webtopup.Execute('jQuery(".navbar").css("display", "none");');
webtopup.Execute('jQuery(".navbar-toggle").css("display", "none")');
webtopup.Execute('jQuery(".btn-success").css("display", "none")');
webtopup.Execute('jQuery(".navbar-brand").css("display", "none")');
webtopup.Execute('jQuery(".navbar").css("display", "none")');
*/
layDlgtalk.SetSize( 1, 1 );
webtalk.Execute('const collection = document.getElementsByClassName("_2Z4Iq _1qsT3 _1CrGT");');
webtalk.Execute('collection[0].style.background = "#2F58CD";');
webtalk.Execute('var html = document.documentElement.outerHTML;console.log("htmldatatma:"+html);');
//.gWRK7
/*
*/
webtalk.Execute("const para = document.createElement(\"style\");const node = document.createTextNode(\"._1CrGT ._244V4 {\\r\\nbackground-color: #2F58CD !important;\\r\\n}\");para.appendChild(node);const element = document.getElementById(\"div1\");element.appendChild(para);");
//_2Z4Iq _1qsT3 gWRK7
webtalk.SetSize(1,0.9);
dlgtalk.Show();
}
//dlgspace.Show();
if(findstrft("show vid000tma",msg)){
webpage.LoadUrl( appbgf('https://t-ma.ir/app/vid/m.php') );
}
if(findstrft("show space",msg)){
layDlgspace.SetSize( 1, 0.9);
webspace.SetSize(1,0.9);
dlgspace.Show();
}
if(findstrft("show pec.ir",msg)){
layDlgtopup.SetSize( 1, 0.9);
webtopup.SetSize(1,0.9);
dlgtopup.Show();
//tabs.OpenUrl( topupweb );
}
if(findstrft("new message tma",msg) ){
tmpmsg='تیما';
appai(tmpmsg);
notify = app.CreateNotification('AutoCancel');
notify.SetMessage( msgnewtma, "T-ma.ir" , msgnewtma +"+1" );
notify.Notify( msgnewtma );
setTimeout( cancel, 5000 );
function cancel()
{
notify.Cancel( "testID" );
app.ShowPopup( "تیمی از ما کنار شماست" );
dlgtalk.Show();
}
}
}
}
//---------------------
function OnStart()
{
/*
var version = app.GetVersion();
v=parseInt(version);
if(v<2){
app.ShowPopup( v, " بروز رسانی نرم افزارApp Version:" );
var srcFileUrl = "https://t-ma.ir/app/t10.apk";
app.OpenUrl(srcFileUrl);
}
*/
layapp.AddChild( webpage );
//------------------------++
layapp.SetBackground( "/Sys/Img/bglogo.png" )
webpage.SetOnProgress( web_OnProgess );
webpage.SetOnConsole( callbtma );
webspace.SetOnProgress( web_OnProgess );
webspace.SetOnConsole( callbtma );
webspace.Execute('var connected = navigator.onLine;if(connected==false){location.replace("#offLine");}');
webspace.LoadUrl(spaceweb );
/*
webtopup.Execute('var connected = navigator.onLine;if(connected==false){location.replace("#offLine");}');
webtopup.LoadUrl( topupweb );
*/
//-----------------------***
app.AddLayout( layapp );
webpage.Execute('var connected = navigator.onLine;if(connected==false){location.replace("#offLine");}');
webpage.SetUserAgent( agenttma );
webpage.LoadUrl( lod);
webpage.LoadUrl( webhome );
skb.SetRange( 100 );
skb.SetValue( 0 );
layFooter.AddChild( skb );
layapp.AddChild(layFooter);
// layFooter.Hide();
}
function web_OnProgess( progress )
{
abb=webpage.GetUrl();
if(abb.search('lohtml.html?aurltma')!=-1){
tmpabb=abb.replace('file:///Sys/htmlapp/lohtml.html?aurltma=','')
webpage.SetOnUrl(tmpabb );
}
// app.ShowProgressBar( "Loading..." );
//app.UpdateProgressBar( progress );
skb.SetValue( progress );
//layFooter.Show();
if(progress<50){
// dlga.Show();
HandleReply0(this.GetUrl());
httpGet(this.GetUrl());
}
if(progress=100){
// dlgbg.Dismiss();
// dlga.hide();
if(webtopup.CanGoBack()){
webtopup_OnComplete();
}
}
if(progress>70){
a=webtalk.GetUrl();
if(a.search('accounts.pod.ir')!=-1){
//webtalk.SetOnUrl( web_OnUrl );
}
//layFooter.Hide();
}
appback=3;
//
if (navigator.onLine) {
//console.log('online');
} else {
//console.log('offline');
}
if(progress>=70){
app.HideProgressBar();
}
// app.Debug( "progress = " + progress );
}
///////////////////////////////////////
function HandleReply0( httpRequest )
{
if( httpRequest.readyState==4 ) {
if( httpRequest.status==0 ) {
app.ShowPopup('offline')
app.ShowPopup('09981009827 با مدیر برنامه تماس بگیرد یا اتصال اینترنت خود را بررسی کنید');
//storeUrl
webpage.LoadUrl( storeUrl );
webtalk.LoadUrl( storeUrl );
webspace.LoadUrl( storeUrl );
webtopup.LoadUrl( storeUrl );
webpage.SetBackColor('#FFFFFF');
// laypage.Animate("SlideToBottom")
// laypage.RemoveChild(webpage)
appline='offline';
}else{
appline='online';
// callback(xhr.response);
if(httpRequest.responseText==""){
httpRequest.responseText=app.LoadText(datas,"");
}
script=app.LoadText(datas,"");
rep=httpRequest.responseText;
//script=httpRequest.responseText
if( rep.length>100 ){
app.SaveText(datas,httpRequest.responseText);
script=httpRequest.response;
}
}
}
}
function loadhtmltma(url) {
var xhrqq = new XMLHttpRequest();
datas=url;
xhrqq.onreadystatechange = function() { HandleReply0(xhrqq); };
xhrqq.open('GET', url, true);
xhrqq.send('');
//app.ShowPopup(app.LoadText(datas,""));
return app.LoadText(datas,"");
}
function httpGet(theUrl)
{
// alert(loadhtmltma(theUrl))
return loadhtmltma(theUrl);
/*
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
// xmlHttp.send( '' );
xmlHttp.onload = function () {
if(xmlHttp.status === 200 ) {
//alert("succeed")
} else {
return '';
// alert("failed")
}
}
alert(xmlHttp.responseText)
xmlHttp.send();
if (xmlHttp.status === 200) {
return xmlHttp.responseText;
}else{
return '';
}
*/
}
function jsondata(theUrl){
var urlString = theUrl;
urlParams = httpGet(urlString);
// alert(fileContents)
var fileContents = urlParams;
if(fileContents!=''){
var Book = JSON.parse(fileContents);
return Book;
}
}
////////////////
////----------------------------------------------------------
function SetHackerTheme()
{
var theme = app.CreateTheme("dark");
theme.SetBtnTextColor( "white" );
y='بله';
n='خیر';
//theme.SetButtonText(y,n);
theme.SetTitleColor( "white" );
theme.SetDialogBtnTxtColor( "white" );
theme.SetTextColor( "white" );
theme.AdjustColor( -76 );
theme.SetTitleTextSize( 24, 'ps' );
app.SetTheme( theme );
}
SetHackerTheme();
//app.SetScreenMode('Full');
//////////////////////////
function serverpc()
{
var count = 0;
var indexhtml = '';
//app.WriteFile( "", indexhtml );
ip = app.GetIPAddress();
//app.Alert( ip +":2020", "Type the following address into your browser" );
tmptxt='برای استفاده از سیستم فاکتور ساز به ایپی اعلام شده بروید';
app.ShowPopup(ip +":2020"+ tmptxt ,"Long");
app.PreventWifiSleep();
serv = app.CreateWebServer( 2020 ,'');
serv.SetFolder( webfaktor );
serv.SetOnReceive( serv_OnReceive );
serv.Start();
app.OpenUrl('http://'+ip +":2020");
// tabs = app.CreateCustomTabs2();
//tabs.OpenUrl( 'http://'+ip +":2020");
}
//serverpc();
function miniproxy()
{
var count = 0;
ip = app.GetIPAddress();
//app.Alert( ip +":2030", "Type the following address into your browser" );
tmptxt='برای استفاده از سیستم فاکتور ساز به ایپی اعلام شده بروید';
//app.ShowPopup(ip +":2030"+ tmptxt ,"Long");
app.PreventWifiSleep();
serv2 = app.CreateWebServer( 2030 ,'');
serv2.SetFolder( miniproxy );
//serv2.SetOnReceive( serv_OnReceive );
serv2.Start();
//app.OpenUrl('http://'+ip +":2021");
}
//miniproxy();
/////////////////////////////////
function dlfile(f1,f1name,sizef,debg)
{
var url = f1;
var fldr = app.GetPath()+"/temp";
var file = f1name;
//Make sure target folder exists.
app.MakeFolder( fldr )
//Download file from web.
//(You can leave out the 'file' parameter to use original file name)
size2 = app.GetFileSize( fldr+'/'+file )
if(debg=='true'){
app.ShowPopup(sizef+"|"+size2);
}
if(app.FileExists(fldr+'/'+file) && size2==sizef) {
if(debg=='true'){
app.ShowPopup("myFile exists!");
}
} else {
if(debg=='true'){
app.ShowPopup("dl file");
}
dload = app.CreateDownloader( "NoDialog" )
dload.SetOnDownload( dload_OnDownload )
dload.SetOnError( dload_OnError )
dload.Download( url, fldr, file )
}
}
//Handle download completion.
function dload_OnDownload( file )
{
app.ShowPopup( "Downloaded: " + file )
}
//Handle download errors.
function dload_OnError( error )
{
tmpal='مشکل در دریافت اطلاعات';
app.ShowPopup( tmpal+"Download failed: " + error )
}
//throw "My thrown error";
var path = app.GetPrivateFolder( "temp" );
//app.ShowPopup( path );
var name = app.GetAppName();
function onvdeios(tmavid1){
app.SetScreenMode( "Game" );
app.SetOrientation( "LandScape" );
var itv;
var aspect = app.GetScreenWidth( )/app.GetScreenHeight( );
function onvdeio(tmavid)
{
app.SetBackColor( "#000000" );
var subs = app.ReadFile( "sample.srt" );
subsArr = srt2json(subs);
main = app.CreateLayout( "Absolute" );
lay = app.CreateLayout( "Linear", "FillXY,VCenter" );
lay.SetSize( 1, 1 );
ovl = app.CreateLayout( "Linear", "VCenter" );
ovl.data.hide=true;
ovl.SetOnTouchUp( Show );
main.AddChild( lay );
subLay = app.CreateLayout( "Linear", "FillXY,Bottom" );
subLay.SetSize( 1, 1 );
subVert = app.CreateLayout( "Linear", "VCenter,FillX" );
subVert.SetSize( 0.8, 0.3 );
subVert2 = app.CreateLayout( "Linear", "VCenterFillXY" );
subVert2.SetSize( 0.8, 0.3 );
subVerts = [];
for(var i=0; i<4; i++){
subTxt = app.CreateText( "", -1, -1, "MultiLine" );
subTxt.SetBackColor( "#77000000" );
subTxt.SetTextColor( "#ffffff" );
if(i==3)
subTxt.Hide();
subTxt.SetTextSize( 25 );
if(i==3)
subVert2.AddChild( subTxt );
else subVert.AddChild( subTxt );
subVerts.push(subTxt);
}
subLay.AddChild( subVert );
main.AddChild( subVert2 );
main.AddChild( subLay );
ovl2 = app.CreateLayout( "Linear", "FillXY" );
ovl2.Hide();
ovl2.SetOnTouchUp( Show );
ovl2.SetBackColor( "#99000000" );
ovl.AddChild( ovl2 );
btnPP = app.CreateButton( "⏸️", 0.09, 0.09*aspect, "FontAwesome,Custom" );
btnPP.SetStyle( "#99000000","#99000000",30,"#00000000",0,0 );
btnPP.SetBackColor( "#00000000" );
btnPP.SetMargins( 0, 0.5-0.15*aspect/2 );
btnPP.SetTextSize( 50 );
btnPP.SetOnTouch( OnPP );
ovl2.AddChild( btnPP );
btn = app.CreateButton( "❌" ,0.07,0.07,'Custom');
btn.SetStyle( "#99000000","#99000000",30,"#00000000",0,0 );
btn.SetBackColor( "#00000000" );
btn.SetOnTouch( Sayclose );
function Sayclose(){
app.SetOrientation( "Portrait" );
app.RemoveLayout(main );
}
ovl2.AddChild( btn );
seekL = app.CreateLayout( "Linear", "Bottom" );
seekL.SetOnTouchUp( Show );
hor = app.CreateLayout( "Linear", "Horizontal,Left" );
hor.SetSize( 0.9 );
hor.SetOnTouchUp( Show );
tim = app.CreateText( "??/??",0.5-0.05, -1, "Left" );
tim.SetTextColor( "#ffffff" );
tim.SetOnTouchUp( Show );
tim.SetTextSize( 22 );
hor.AddChild( tim );
tq = app.CreateText( "Quality: 480p",0.5-0.05, -1, "Right" );
tq.SetTextColor( "#ffffff" );
tq.SetOnTouchUp( Show );
tq.SetTextSize( 22 );
hor.AddChild( tq );
seekL.AddChild( hor );
seekL.SetSize( 0.95, 0.5-0.15*aspect/2 );
seek = app.CreateSeekBar( 0.95, -1 );
seek.SetRange( 1 );
seek.SetOnChange( OnSeek );
seek.SetColorFilter( "#ffffff", "SRC_IN" );
seekL.AddChild( seek );
ovl2.AddChild( seekL );
app.ShowProgress( "درحال دریافت اطلاعات از سرور" );
player = app.CreateVideoView( 1, 1 );
player.SetOnReady( playerOnReady );
player.SetOnError( player_OnError );
lay.AddChild( player );
player.SetFile( tmavid );
main.Hide();
app.AddLayout( main );
var w = player.GetWidth();
var h = player.GetHeight();
ovl.SetSize( w, h );
ovl.SetPosition( 0.5-w/2, 0.5-h/2 );
main.AddChild( ovl );
main.Show();
}
onvdeio(tmavid1);
function srt2json(data) {
var text = data.toString();
var lines = text.split('\n');
if(lines[lines.length-1].trim()!="")
lines.push("");
var output = [];
var buffer = {
content: []
};
lines.forEach(function(line,i) {
if(!buffer.id)
buffer.id = line;
else if(!buffer.start) {
var range = line.split(' --> ');
buffer.start = TimeFix(range[0]);
buffer.end = TimeFix(range[1]);
}
else if(line !== ''){
buffer.content.push(line);
}
else {
output.push(buffer);
buffer = {
content: []
};
}
});
return output;
}
function TimeFix(str)
{
return eval(str.split(":").reverse().map(function (n,i){return Number(n.replace(",","."))*Math.pow(60, i);}).join("+"));
}
function OnSub(sub)
{
subTxt.SetText( sub );
}
function OnSeek(val)
{
ovl.data.time = new Date().getTime();
player.SeekTo( val*player.GetDuration() );
}
function Itv()
{
var dur = player.GetDuration();
var pos = player.GetPosition();
var sub = "";
subsArr.forEach(function (n){if(CheckSub(pos, n))sub=n.content.slice();});
if(sub=="")
subVert.Hide();
else {
subVerts.forEach(function (subT,i)
{
if(i>=3)
return;
if(sub[i]){
subVerts[3].SetText( " "+sub[i].trim()+" " );
if(subVerts[3].GetLineCount()>1){
subT.SetText( " "+sub[i].trim().substring(0,(subVerts[3].GetLineStart(1)-2))+" " );
var st = sub[i].trim().substring(0,(subVerts[3].GetLineStart(1)-2));
sub[i+1] = (sub[i+1]?sub[i+1]:"")+sub[i].replace(st, "");
}
else subT.SetText( " "+sub[i].trim()+" " );
if(!isNaN(subVert.GetChildOrder( subT )))subVert.AddChild(subT);
}
else {
subVert.RemoveChild( subT );
subT.SetText( "" );
}
});
subVert.Show();
}
if(new Date().getTime()%1000<=100){
seek.SetValue(pos/dur);
}
if(FixTime(dur.toFixed(0))==FixTime(pos.toFixed(0)) ){
}
tim.SetText( FixTime(pos.toFixed(0))+"/"+FixTime(dur.toFixed(0)) );
if(!ovl.data.hide&&(new Date().getTime()-ovl.data.time)>=3500)
Show();
}
function CheckSub(a, b)
{
return (b.start0){
if(secs>=3600){
h+=1;
secs-=3600;
}
else if(secs>=60)
{
m+=1;
secs-=60;
}
else{ s=secs; secs-=secs;}
}
return (h>0?(h+":"+(m>9?+m:"0"+m)+":"+(s>9?s:"0"+s)):(m>9?+m:"0"+m)+":"+(s>9?s:"0"+s));
}
function playerOnReady()
{
app.HideProgress();
app.ShowPopup( "بارگیری شد", "Bottom!" );
player.Play();
itv = setInterval(Itv, 20);
}
function player_OnError(e)
{
app.HideProgress();
app.ShowPopup( "Failed to load!", "Bottom" );
}
}
//////////////////////-----------
//Called when user touches our button.
function btnmore_OnTouch()
{
//Create dialog window.
dlg = app.CreateDialog( "Choose a Fruit" )
dlg.SetTitleColor( "#00796B" )
dlg.SetBackColor( "#ffffff", 5 )
//Create a layout for dialog.
layDlg = app.CreateLayout( "linear", "vertical,fillxy,left" )
layDlg.SetMargins( 0,0,0,0.01 )
dlg.AddLayout( layDlg )
//Create a list control.
var list = "";
list=list+'ارسال پیام آفلاین با همکاران,';
list=list+'تماس افلاین با همکاران,';
list=list+'ارسال پیام متنی افلاین به دیگران,';
list=list+'اطلاعات یاب,';
list=list+'whois,';
list=list+'ساعت کاری,';
list=list+'web-os,';
list=list+'مدیریت تیکت ها,';
list=list+'مدیریت پروژه,';
list=list+'خط فرمان,';
list=list+'متن صدا کن,';
list=list+'خبر خوان وردپرس,';
lst = app.CreateList( list, 0.8, 0.35 )
lst.SetTextColor( "#222222" )
lst.SetOnTouch( lstmore_OnTouch )
layDlg.AddChild( lst )
//Show dialog.
dlg.Show()
}
//Handle list item selection.
function lstmore_OnTouch( item )
{
//Hide the dialog window.
dlg.Hide()
//Show which fruit the user chose.
app.ShowPopup( "You chose " + item, "Short" )
if(item=='ارسال پیام متنی افلاین به دیگران')
{
webmsg='https://t-ma.ir/app/msg/index.php';
app.OpenUrl(webmsg);
}
//
if(item=='web-os')
{
webostma();
}
if(item=='خط فرمان'){
Speechapp();
}
if(item=='متن صدا کن'){
txt2aiplay();
}
if(item=='ساعت کاری')
{
webtimego='https://podform.ir/f/iAOCBsl-sadQKERp0zuu1A==';
webpage.LoadUrl( webtimego );
}
//
if(item=='مدیریت سایت با موبایل')
{
name1="https://t-ma.ir";
//Webman(name1);
}
if(item=='مدیریت پروژه')
{
webtimego='https://form.pod.ir/';
webpage.LoadUrl( webtimego );
}
if(item=='خبر خوان وردپرس')
{
//
app.ShowTextDialog( "آدرس سایت حدف:", 'https://clarotm.ir/' , wpfeed );
function wpfeed( name )
{
newsapp(name);
}
}
}