-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtemplate.html
83 lines (59 loc) · 2.34 KB
/
template.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>FarBox模板引擎</title>
<link rel="stylesheet" href="{{ resource_host }}/css/clone-template.css?version={{ resource_version }}">
<script type="text/javascript" src="{{ resource_host }}/lib/jquery/1.8.1-jquery.min.js"></script>
<script src="{{ resource_host }}/swfstore/swfstore.min.js" type="text/javascript"></script>
</head>
<body>
<div id="clone_template">
<label for="site">你的网站地址:</label>
<input type="text" id="site"/>
{% if get_template_key() %}
<div class="checkbox">
<input type="checkbox" id="auto_update"/>
<label>自动更新模板</label>
</div>
{% endif %}
<a class="button" href="#" onclick="clone_template();return false;" id="redirect">
克隆模板
</a>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#auto_update').mousedown(function() {
if (!$(this).is(':checked')) {
this.checked = confirm("克隆的网站模板有可能会处于变动的状态;除了作者的修正、优化、增强之外,也有可能引发错误甚至暗门。\n\n" +
"请确保你是信任当前模板的作者?");
$(this).trigger("change");
}
});
var info_store = new SwfStore({
namespace: 'farbox',
swf_url: 'http://resource.farbox.com/swfstore/storage.swf',
debug: true,
onready: function(){
$('#site').val(info_store.get('template_site') || '')
},
onerror: function(){
}
});
$('#redirect').click(function(){
info_store.set('template_site', $('#site').val());
});
$('#site').focus();
});
function clone_template(){
var domain = $.trim($('#site').val()).toLowerCase();
if (domain.indexOf('http://')==-1){
domain = 'http://' + domain;
}
var url = domain.replace(/\/$/g, '') + '/?template_site_id={{ site._id }}';
url += '&auto_update='+ $('#auto_update').is(':checked');
window.location.href = url;
}
</script>
</body>
</html>