Skip to content

Commit

Permalink
Remove unused jQuery (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov authored May 20, 2022
1 parent ab79331 commit 38e48b4
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 70 deletions.
66 changes: 37 additions & 29 deletions web/embed/embed.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,48 @@
<!DOCTYPE html>
<html>
<style type="text/css">
html { margin:0; height: auto; }
</style>
<html lang="en">
<style>
html {
margin: 0;
height: auto;
}
</style>

<head>
<title id="app-title">Cloud Morph Demo</title>
<title id="app-title">Cloud Morph Demo</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="/static/css/main.css" rel="stylesheet" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZZ8L95MM0V"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
<link href="/static/css/main.css" rel="stylesheet"/>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZZ8L95MM0V"></script>
<script>
window.dataLayer = window.dataLayer || [];

gtag('config', 'G-ZZ8L95MM0V');
</script>
function gtag() {
dataLayer.push(arguments);
}

gtag('js', new Date());

gtag('config', 'G-ZZ8L95MM0V');
</script>
</head>

<body>
<style type="text/css">
body { margin:0; height: auto; }
</style>
<style type="text/css">
body {
margin: 0;
height: auto;
}
</style>

<video id="app-screen" oncontextmenu="return false;" muted playinfullscreen="false" poster="/static/img/loading.gif" playsinline
onloadstart="this.volume=0.5" autoplay width="100%" height="100%"></video>
<script src="/static/js/log.js"></script>
<script src="/static/js/env.js"></script>
<script src="/static/js/event/event.js"></script>
<script src="/static/js/network/socket.js"></script>
<script src="/static/js/network/rtcp.js"></script>
<script src="/static/js/appcontroller.js"></script>
<script src="/static/js/init.js"></script>
<video id="app-screen" oncontextmenu="return false;" muted playinfullscreen="false" poster="/static/img/loading.gif"
playsinline
onloadstart="this.volume=0.5" autoplay width="100%" height="100%"></video>
<script src="/static/js/log.js"></script>
<script src="/static/js/env.js"></script>
<script src="/static/js/event/event.js"></script>
<script src="/static/js/network/socket.js"></script>
<script src="/static/js/network/rtcp.js"></script>
<script src="/static/js/appcontroller.js"></script>
<script src="/static/js/init.js"></script>
</body>

</html>

5 changes: 1 addition & 4 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<!DOCTYPE html>
<html>

<html lang="en">
<head>
<title id="app-title">Cloud Morph Demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="/static/css/main.css" rel="stylesheet" />
</head>

<body>
<div id="app-body">
<div id="discovery">
Expand Down
2 changes: 1 addition & 1 deletion web/js/appcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@
event.sub(MOUSE_DOWN, onMouseDown);
event.sub(MOUSE_UP, onMouseUp);
event.sub(KEY_STATE_UPDATED, (data) => rtcp.input(data));
})($, document, event, env);
})(document, event, env);
2 changes: 1 addition & 1 deletion web/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,4 @@
event.sub(UPDATE_APP_LIST, ({ data }) => {
updateAppList(JSON.parse(data));
});
})($, document, event, env, socket);
})(document, event, env, socket);
35 changes: 1 addition & 34 deletions web/js/env.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
const env = (() => {
// UI
const doc = $(document);
const gameBoy = $('#gamebody');
const ghRibbon = $('#ribbon');

let isLayoutSwitched = false;

// Window rerender / rotate screen if needed
const fixScreenLayout = () => {
let targetWidth = Math.round(doc.width() * 0.9 / 2) * 2,
targetHeight = Math.round(doc.height() * 0.9 / 2) * 2;

// mobile == full screen
if (env.getOs() === 'android') {
targetWidth = doc.width();
targetHeight = doc.height();
}

// Should have maximum box for desktop?
// targetWidth = 800; targetHeight = 600; // test on desktop

let st = isLayoutSwitched ? 'rotate(90deg)' : '';
ghRibbon.css({
'bottom': isLayoutSwitched ? 0 : '',
'top': isLayoutSwitched ? '' : 0,
'transform': st,
'-webkit-transform': st,
'-moz-transform': st
})
};

const getOS = () => {
// linux? ios?
let OSName = 'unknown';
Expand Down Expand Up @@ -102,8 +71,6 @@ const env = (() => {
display: () => ({
isPortrait: isPortrait,
toggleFullscreen: toggleFullscreen,
fixScreenLayout: fixScreenLayout,
isLayoutSwitched: isLayoutSwitched
})
}
})($, document, log, navigator, screen, window);
})(document, log, navigator, screen, window);
2 changes: 1 addition & 1 deletion web/js/network/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ const socket = (() => {
connect: connect,
// quit: quit,
};
})($, event, log);
})(event, log);

0 comments on commit 38e48b4

Please sign in to comment.