mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 18:13:46 +01:00
tpl: using HFS.sid we can move ajax() where it belongs
This commit is contained in:
parent
7facca0306
commit
7634b96744
29
default.tpl
29
default.tpl
@ -26,10 +26,10 @@ def 3.0
|
|||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="shortcut icon" href="/favicon.ico">
|
<link rel="shortcut icon" href="/favicon.ico">
|
||||||
<link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
|
<link rel="stylesheet" href="/~style.css" type="text/css">
|
||||||
<script type="text/javascript" src="/?mode=jquery"></script>
|
<script type="text/javascript" src="/?mode=jquery"></script>
|
||||||
<script>var HFS = { user:'{.js encode|%user%.}', folder:'{.js encode|%folder%.}', sid:"{.cookie|HFS_SID_.}" }</script>
|
<script>var HFS = { user:'{.js encode|%user%.}', folder:'{.js encode|%folder%.}', sid:"{.cookie|HFS_SID_.}" }</script>
|
||||||
<script type="text/javascript" src="/?mode=section&id=lib.js"></script>
|
<script type="text/javascript" src="/~lib.js"></script>
|
||||||
|
|
||||||
[]
|
[]
|
||||||
{.$common-head.}
|
{.$common-head.}
|
||||||
@ -80,18 +80,6 @@ def 3.0
|
|||||||
.}
|
.}
|
||||||
}//changePwd
|
}//changePwd
|
||||||
|
|
||||||
function ajax(method, data, cb) {
|
|
||||||
if (!data)
|
|
||||||
data = {};
|
|
||||||
data.token = "{.cookie|HFS_SID_.}";
|
|
||||||
showLoading()
|
|
||||||
return $.post("?mode=section&id=ajax."+method, data).then(function(){
|
|
||||||
if (cb)
|
|
||||||
showLoading(false)
|
|
||||||
;(cb||getStdAjaxCB()).apply(this,arguments)
|
|
||||||
}, ajaxError);
|
|
||||||
}//ajax
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id='menu-panel'>
|
<div id='menu-panel'>
|
||||||
@ -630,6 +618,19 @@ add bytes=switch|{.cut|-1||$1.}|,|0,1,2,3,4,5,6,7,8,9|$1 {.!Bytes.}|K,M,G,T|$1B
|
|||||||
// <script> // this is here for the syntax highlighter
|
// <script> // this is here for the syntax highlighter
|
||||||
|
|
||||||
{.$sha256.js.}
|
{.$sha256.js.}
|
||||||
|
|
||||||
|
function ajax(method, data, cb) {
|
||||||
|
if (!data)
|
||||||
|
data = {};
|
||||||
|
data.token = HFS.sid; // avoid CSRF attacks
|
||||||
|
showLoading()
|
||||||
|
return $.post("?~ajax."+method, data).then(function(){
|
||||||
|
if (cb)
|
||||||
|
showLoading(false)
|
||||||
|
;(cb||getStdAjaxCB()).apply(this,arguments)
|
||||||
|
}, ajaxError);
|
||||||
|
}//ajax
|
||||||
|
|
||||||
function outsideV(e, additionalMargin) {
|
function outsideV(e, additionalMargin) {
|
||||||
outsideV.w || (outsideV.w = $(window));
|
outsideV.w || (outsideV.w = $(window));
|
||||||
if (!(e instanceof $))
|
if (!(e instanceof $))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user