Skip to content

Commit

Permalink
Теперь приложения меньше сжирают ваш трафик на 12.2%
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbytes committed Nov 27, 2017
1 parent 2420703 commit 9e963c2
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 159 deletions.
60 changes: 15 additions & 45 deletions makeprocess.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function makeprocess($destination, $idprocess, $param, $key, $name){
$folder=stristr($folder, 'system/');
$destination=stristr($destination, 'system/');
$appicon=$folder.'/app.png';

if (!is_file($appicon)){
$appicon='system/core/design/images/app.png';
}
Expand All @@ -48,7 +47,6 @@ function makeprocess($destination, $idprocess, $param, $key, $name){
if(!preg_match('/.php/',$destination_)){
$destination_ = $destination_.'.php';
}

$style="'display','block'";
$style2="'display','none'";
echo '<div id=app'.$idprocess.' style="max-width:'.$maxwidth.'; position:absolute; left:'.$left.'; top:'.$top.'; overflow:hidden;" class="ui-widget-content window windownormal windowborder">
Expand All @@ -57,57 +55,29 @@ function makeprocess($destination, $idprocess, $param, $key, $name){
<div class="appwindowbutton"'; echo ' onClick=" $(';echo "'#"; echo 'process'.$idprocess; echo "'"; echo ').remove();';echo ' $(';echo "'#"; echo "app$idprocess"; echo "'"; echo ').css('; echo "$style2"; echo '); checkwindows();" style="background-color:#ed2020;">x</div>
<div class="hidewindow'.$idprocess.' appwindowbutton" onClick="" style="background-color:#37a22e;">-</div>
<div class="reload'.$idprocess.' appwindowbutton" onClick="" style="background-color:#e09100;">o</div>
</div><div id='.$idprocess.' style="position:relative;" class="blurwindowpassive hideallclass process-container" location="'.str_replace(array('//','php/'),array('/','php'),$destination_).'"></div></div></div>';
</div><div id='.$idprocess.' class="blurwindowpassive hideallclass process-container" location="'.str_replace(array('//','php/'),array('/','php'),$destination_).'"></div></div></div>';
?>
<div id="logic<?echo $idprocess;?>">
<script async>
$( "#<?echo 'app'.$idprocess?>" ).draggable({containment:"body",handle:"<?echo '#drag'.$idprocess?>", snap:".ui-body, .dragwindowtoggle, #topbar"});
$( "#<?echo 'app'.$idprocess?>" ).resizable({containment:"body",minHeight:$(window).height()*0.15,minWidth:$(window).width()*0.15,maxWidth:$(window).width()*<?echo $maxwidthm;?>,maxHeight:$(window).height()*0.95,autoHide:<?echo $autohide;?>,alsoResize:"#<?echo $name.$idprocess?>"});
$( "#<?echo 'app'.$idprocess?>" ).click(function(){$("#<?echo 'app'.$idprocess?>" ).addClass("windowactive")});
$( "#<?echo 'drag'.$idprocess?>" ).click(function(){$("#<?echo 'app'.$idprocess?>" ).addClass("windowactive")});
$( "#<?echo 'drag'.$idprocess?>" ).dblclick(function(){
$("#<?echo 'app'.$idprocess?>" ).css({
top:"29px",left:"0"
})
});
$( ".window" ).mouseup(function(){$(".window").removeClass("windowactive")});
if(!$("#process<?echo $idprocess;?>").hasClass('hibernatethis')){
$("#<?echo $idprocess;?>" ).load("<? echo $destination.'?id='.rand(0,10000).'&appid='.$idprocess.'&appname='.$name.'&destination='.$folder.'/&mobile='.$click.'&'.$key.'='.$param;?>");
}
$(function() {
$(".window").removeClass("windowactive");
$("#<?echo 'app'.$idprocess?>" ).addClass("windowactive");
});
function runEffect() {
var options = {};
$( "#<?echo $idprocess;?>" ).toggle( "slide", options, 100 );
};
$( ".hidewindow<?echo $idprocess;?>" ).on( "click", function() {
runEffect();
if($( "#<?echo 'app'.$idprocess?>" ).hasClass("ui-resizable")){
$( "#<?echo 'app'.$idprocess?>" ).resizable({disabled:true,containment:"body"});
}
if($( "#<?echo 'app'.$idprocess?>" ).hasClass("windowborderhide")){
$( "#<?echo 'app'.$idprocess?>" ).resizable({disabled:false,containment:"body",minHeight:$(window).height()*0.15,minWidth:$(window).width()*0.15,maxWidth:$(window).width()*<?echo $maxwidthm;?>,maxHeight:$(window).height()*0.95,autoHide:<?echo $autohide;?>,alsoResize:"#<?echo $name.$idprocess?>"});
}
$( "#<?echo 'drag'.$idprocess;?>" ).toggleClass( "dragwindowtoggle", 500 );
$( "#<?echo 'app'.$idprocess;?>" ).toggleClass( "windowborderhide", 500 );
$( "#<?echo 'app'.$idprocess;?>" ).toggleClass( "bordertoggle", 1 );
});
$(".reload<?echo $idprocess;?>" ).on( "click", function() {
$("#<?echo $idprocess;?>" ).load("<? echo $destination_.'?id='.rand(0,10000).'&appid='.$idprocess.'&appname='.$name.'&destination='.$folder.'/&mobile='.$click.'&'.$key.'='.$param;?>");
});
$("#<?echo 'drag'.$idprocess?>" ).on( "dblclick", function() {
$("#<?echo 'app'.$idprocess?>" ).toggleClass( "windowfullscreen", 100 );
});
$("#process<?echo $idprocess;?>" ).appendTo("#proceses");
ProcessLogic(
"<?echo $idprocess?>",
"<?echo $name?>",
"<?echo $destination?>",
"<?echo $destination_?>",
"<?echo $maxwidthm?>",
"<?echo $folder?>",
"<?echo $click?>",
"<?echo $key?>",
"<?echo $param?>",
"<?echo $autohide?>"
);
</script>
</div>
<?
}
makeprocess($d, $i, $p, $k, $n);
}else{
header('Location: os.php');
exit;
header('Location: login.php');
die();
}
?>
125 changes: 11 additions & 114 deletions os.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?
$osinfo = parse_ini_file('system/core/osinfo.foc', false);
$os_version = $osinfo['codename'].' '.$osinfo['subversion']."\n";
?>
<!--
____ __ ____ ____
/ __/__ _______ ___ / /_ / __ \/ __/
/ _// _ \/ __/ -_|_-</ __/ / /_/ /\ \
/_/ \___/_/ \__/___/\__/ \____/___/
WET STONE 1.0
<?echo $os_version?>
-->
<?
require 'system/core/library/gui.php';
Expand Down Expand Up @@ -41,125 +45,18 @@
</div>
</div>
<div id="proceses">
<script>
var id=<?echo $_SESSION['appid']=$_SESSION['appid']+1?>;
<?
require 'system/core/library/js/core-js.php';
?>
</script>
<?
$prepare->hibernation();
?>
</div>
</body>
</html>
<script>
var id=<?echo $_SESSION['appid']=$_SESSION['appid']+1?>;

function hibernation(logout){
$('.process').addClass('hibernatethis');
var savestate = ($('#proceses').html());
$.ajax({
type: "POST",
url: "system/core/library/etc/hibernation",
data: {
content:savestate,
appid:id
}
}).done(function(o) {
if(logout == 'true'){
return location.href = '?action=logout';
}
if(logout == 'false'){
return location.href = 'os.php';
}
});
}
function checkwindows(){
closestyle="";
var prc=$(".process").length;
if (prc>1){
closestyle="inline";
}else{
closestyle="none";
}
$(".topbaractbtn").css('display',''+window.closestyle+'');
}

function makeprocess(dest,param,key,name){
$('.ui-body').append("<div id=\"process"+(id=id+1)+"\" class='process' style='display:none;'></div>");
$("#process"+id+"").show('drop',500);
$("#process"+id+"" ).load("makeprocess.php?id=<?echo md5(date('d.m.y.h.i.s'));?>"+id+"&d="+dest+"/&i="+id+"&p="+param+"&k="+key+"&n="+name);
checkwindows();
};

$( function() {
$( "#notificationsbtn" ).on( "click", function() {
$('.notificationclass').css('opacity','0');
if($( "#notifications" ).hasClass("notificationshow"))
{
$('.notificationclass').css('opacity','0');
$('.notificationclass').css('display','none');
}else{
$('.notificationclass').css('opacity','0.97');
$('.notificationclass').css('display','block');
}
$( ".notificationhide" ).toggleClass( "notificationshow", 100 );
});
$( "#topbar" ).on( "dblclick", function() {
$( ".blurwindowpassive" ).toggleClass( "blurwindowactive", 100 );
});

function runEffect() {
var options = {};
$( ".hideallclass" ).toggle( "slide", options, 100 );
};
$( "#hideall" ).on( "click", function() {
runEffect();
$( ".dragwindow" ).toggleClass( "dragwindowtoggle", 500 );
$( ".windowborder" ).toggleClass( "windowborderhide", 500 );
$( ".windowborder" ).toggleClass( "bordertoggle", 1 );
});
});

function releaselink(){
$(".linktheme").css({
'white-space' : 'nowrap',
'background-color' : 'transparent',
'border' : ''
});
}

function UpdateWindow(id,name){
var parentWidth = $("#app"+id).css('width');
var parentHeight = $("#app"+id).css('height');
if(parentHeight!='0px'){
$("#"+name+id).css('width', parentWidth);
$("#"+name+id).css('height', parentHeight);
}
}

$( function() {
$(window).load(function(){
$(".welcomescreen").hide('fade',500);
$("#topbar").show('fade',1500);
$("#topbar").css('display','block')
$(".trashdrop").droppable({
accept: ".ico",
drop: function(event, ui){
var del_file = ui.draggable.attr('d');
$.ajax({
type: "POST",
url: "system/core/functions/trash",
data: {
file_delete: del_file
}
}).done(function(o) {
$(".link"+ui.draggable.attr('i')).remove();
});
}
});
});
$( ".ico" ).draggable({containment:"body", snap:".ico, #topbar"});
$( ".window" ).mouseup(function(){
$(".window").removeClass("windowactive")
});
});
</script>
<?
$_SESSION['appid'] = '<script>document.writeln(id)</script>';
$prepare->autorun();
Expand Down
1 change: 1 addition & 0 deletions system/apps/Apps_House/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ function fullhouseupd<?echo $appid;?>(el4){$(".apphouseinfohide").css('display',
function update<?echo $appid;?>(){
makeprocess('system/apps/update/main.php','','','Update');
}
UpdateWindow("<?echo $appid?>","<?echo $appname?>");
</script>
<?
unset($appid);
Expand Down
153 changes: 153 additions & 0 deletions system/core/library/js/core-js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

function hibernation(logout){
$('.process').addClass('hibernatethis');
var savestate = ($('#proceses').html());
$.ajax({
type: "POST",
url: "system/core/library/etc/hibernation",
data: {
content:savestate,
appid:id
}
}).done(function(o) {
if(logout == 'true'){
return location.href = '?action=logout';
}
if(logout == 'false'){
return location.href = 'os.php';
}
});
}

function checkwindows(){
closestyle="";
var prc=$(".process").length;
if (prc>1){
closestyle="inline";
}else{
closestyle="none";
}
$(".topbaractbtn").css('display',''+window.closestyle+'');
}

function makeprocess(dest, param, key, name){
$('.ui-body').append("<div id=\"process"+(id=id+1)+"\" class='process' style='display:none;'></div>");
$("#process"+id+"").show('drop',500);
$("#process"+id+"" ).load("makeprocess.php?id=<?echo md5(date('d.m.y.h.i.s'));?>"+id+"&d="+dest+"/&i="+id+"&p="+param+"&k="+key+"&n="+name);
checkwindows();
};

function ProcessLogic(id, name, destination, destination_, maxwidthm, folder, click, key, param, autohide){
$( "#app" + id ).draggable({containment:"body",handle:"#drag" + id, snap:".ui-body, .dragwindowtoggle, #topbar"});
$( "#app" + id ).resizable({containment:"body",minHeight:$(window).height()*0.15,minWidth:$(window).width()*0.15,maxWidth:$(window).width()*maxwidthm,maxHeight:$(window).height()*0.95,autoHide:autohide,alsoResize:"#"+name+id});
$( "#app" + id ).click(function(){$("#app" + id ).addClass("windowactive")});
$( "#drag" + id ).click(function(){$("#app" + id ).addClass("windowactive")});
$( "#drag" + id ).dblclick(function(){$("#app" + id ).css({top:"29px",left:"0"})});
$( ".window" ).mouseup(function(){$(".window").removeClass("windowactive")});
if(!$("#process" + id).hasClass('hibernatethis')){
$("#" + id).load(""+destination+"?id=<?rand(0,10000)?>&appid="+id+"&appname="+name+"&destination="+folder+"/&mobile="+click+"&key="+key+"&param="+param+"");
}
$(function() {
$(".window").removeClass("windowactive");
$("#app" + id ).addClass("windowactive");
});
function runEffect() {
var options = {};
$( "#" + id).toggle( "slide", options, 100 );
};
$( ".hidewindow" + id ).on( "click", function() {
runEffect();
if($( "#app" + id ).hasClass("ui-resizable")){
$( "#app" + id ).resizable({disabled:true,containment:"body"});
}
if($( "#app" + id ).hasClass("windowborderhide")){
$( "#app" + id ).resizable({disabled:false,containment:"body",minHeight:$(window).height()*0.15,minWidth:$(window).width()*0.15,maxWidth:$(window).width()*maxwidthm,maxHeight:$(window).height()*0.95,autoHide:autohide,alsoResize:"#"+name+id});
}
$( "#drag" + id ).toggleClass( "dragwindowtoggle", 500 );
$( "#app" + id ).toggleClass( "windowborderhide", 500 );
$( "#app" + id ).toggleClass( "bordertoggle", 1 );
});
$(".reload" + id).on( "click", function() {
$("#" + id).load(""+destination_+"?id=<?rand(0,10000)?>&appid="+id+"&appname="+name+"&destination="+folder+"/&mobile="+click+"&key="+key+"&param="+param+"");
});
$("#drag" + id ).on( "dblclick", function() {
$("#app" + id ).toggleClass( "windowfullscreen", 100, function(){
UpdateWindow(id,name);
});
});
$("#process" + id ).appendTo("#proceses");
};

$( function() {
$( "#notificationsbtn" ).on( "click", function() {
$('.notificationclass').css('opacity','0');
if($( "#notifications" ).hasClass("notificationshow"))
{
$('.notificationclass').css('opacity','0');
$('.notificationclass').css('display','none');
}else{
$('.notificationclass').css('opacity','0.97');
$('.notificationclass').css('display','block');
}
$( ".notificationhide" ).toggleClass( "notificationshow", 100 );
});
$( "#topbar" ).on( "dblclick", function() {
$( ".blurwindowpassive" ).toggleClass( "blurwindowactive", 100 );
});

function runEffect() {
var options = {};
$( ".hideallclass" ).toggle( "slide", options, 100 );
};

$( "#hideall" ).on( "click", function() {
runEffect();
$( ".dragwindow" ).toggleClass( "dragwindowtoggle", 500 );
$( ".windowborder" ).toggleClass( "windowborderhide", 500 );
$( ".windowborder" ).toggleClass( "bordertoggle", 1 );
});
});

function releaselink(){
$(".linktheme").css({
'white-space' : 'nowrap',
'background-color' : 'transparent',
'border' : ''
});
}

function UpdateWindow(id,name){
var parentWidth = $("#app"+id).css('width');
var parentHeight = $("#app"+id).css('height');
if(parentHeight!='0px'){
$("#"+name+id).css('width', parentWidth);
$("#"+name+id).css('height', parentHeight);
}
}

$( function() {
$(window).load(function(){
$(".welcomescreen").hide('fade',500);
$("#topbar").show('fade',1500);
$("#topbar").css('display','block')
$(".trashdrop").droppable({
accept: ".ico",
drop: function(event, ui){
var del_file = ui.draggable.attr('d');
$.ajax({
type: "POST",
url: "system/core/functions/trash",
data: {
file_delete: del_file
}
}).done(function(o) {
$(".link"+ui.draggable.attr('i')).remove();
});
}
});
});
$( ".ico" ).draggable({containment:"body", snap:".ico, #topbar"});
$( ".window" ).mouseup(function(){
$(".window").removeClass("windowactive")
});
});

0 comments on commit 9e963c2

Please sign in to comment.