Browse Source

增加自动刷新选项。

oldj 10 years ago
parent
commit
133d018f6c

+ 1 - 1
app/SH3/MacGap/SwitchHosts!-Info.plist

@@ -21,7 +21,7 @@
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>2890</string>
+	<string>2906</string>
 	<key>LSApplicationCategoryType</key>
 	<string>public.app-category.developer-tools</string>
 	<key>LSMinimumSystemVersion</key>

+ 4 - 0
app/SH3/public/css/style.css

@@ -164,6 +164,10 @@ a:hover {
 #pswd-form .body .ln input[type=password] {
   letter-spacing: 8px;
 }
+#edit-form .body .ln .info,
+#pswd-form .body .ln .info {
+  color: #aaa;
+}
 #edit-form .body .ln .inform,
 #pswd-form .body .ln .inform {
   color: #f03;

+ 2 - 0
app/SH3/public/css/style.styl

@@ -189,6 +189,8 @@ unselectable()
       input[type=password]
         letter-spacing 8px
 
+      .info
+        color #aaa
       .inform
         color color_danger
 

+ 21 - 6
app/SH3/public/index.html

@@ -27,7 +27,8 @@
 					v-dropzone="sort(hosts.list, $index, $droptag, $dropdata)"
 					:class="{selected:host==current_host}">
 					<!--<i class="switch" @click="switchHost(host)" :class="{'on':host.on}"></i>-->
-					<i class="iconfont switch" @click="switchHost(host)" :class="{'icon-on':host.on, 'icon-off':!host.on}"></i>
+					<i class="iconfont switch" @click="switchHost(host)"
+					   :class="{'icon-on':host.on, 'icon-off':!host.on}"></i>
 					<i class="iconfont icon-doc i-h"></i>
 					<span class="title">{{ host.title }}</span>
 					<i class="iconfont icon-edit btn-edit" @click="edit(host)"></i>
@@ -43,11 +44,14 @@
 					<a href="#" @click="add()" title="{{ lang.add_host }}"><i class="iconfont icon-add-s"></i></a>
 				</li>
 				<li class="right">
-					<a href="#" @click="tmpClean()" v-cloak v-if="could_tmp_clean_on" title="{{ lang.tmp_clean }}"><i class="iconfont icon-switchon"></i></a>
-					<a href="#" @click="tmpRecover()" v-cloak v-if="!could_tmp_clean_on" title="{{ lang.tmp_recover }}"><i class="iconfont icon-switchoff"></i></a>
+					<a href="#" @click="tmpClean()" v-cloak v-if="could_tmp_clean_on" title="{{ lang.tmp_clean }}"><i
+							class="iconfont icon-switchon"></i></a>
+					<a href="#" @click="tmpRecover()" v-cloak v-if="!could_tmp_clean_on" title="{{ lang.tmp_recover }}"><i
+							class="iconfont icon-switchoff"></i></a>
 				</li>
 				<li class="right">
-					<a href="#" id="btn-toggle-search" @click="toggleSearch()" :class="{active:is_search_bar_show}"><i class="iconfont icon-search"></i></a>
+					<a href="#" id="btn-toggle-search" @click="toggleSearch()" :class="{active:is_search_bar_show}"><i
+							class="iconfont icon-search"></i></a>
 				</li>
 			</ul>
 		</div>
@@ -84,7 +88,7 @@
 			</div>
 			<div class="ln" v-if="current_edit_host.where=='remote'">
 				<label for="ipt-host-url">{{ lang.url }}</label>
-				<input type="text" id="ipt-host-url" name="host_title"
+				<input type="text" id="ipt-host-url" name="host_url"
 					   placeholder="http://"
 					   maxlength="1024"
 					   v-model="current_edit_host.url"
@@ -94,8 +98,19 @@
 				>
 				<div class="inform">{{ inform.url }}</div>
 			</div>
+			<div class="ln" v-if="current_edit_host.where=='remote'">
+				<label for="ipt-refresh-interval">{{ lang.auto_refresh }}</label>
+				<select name="host_refresh_interval" id="ipt-refresh-interval" v-model="current_edit_host.refresh_interval">
+					<option value="{{ opt[0] }}" v-for="opt in refresh_options">{{ opt[1] }}</option>
+				</select>
+				<span class="info">
+					{{ lang.last_refresh }}: {{ current_edit_host.last_refresh || 'N/A' }}
+				</span>
+			</div>
 			<div class="ln" v-if="add_or_edit=='edit'">
-				<a href="#" class="delete-host" @click="delHost(current_edit_host)"><i class="iconfont icon-delete"></i> {{ lang.del_host }}</a>
+				<a href="#" class="delete-host" @click="delHost(current_edit_host)"><i class="iconfont icon-delete"></i>
+					{{
+					lang.del_host }}</a>
 			</div>
 		</div>
 		<div class="foot">

File diff suppressed because it is too large
+ 0 - 0
app/SH3/public/js/main.js


+ 14 - 0
app/src/lang.js

@@ -28,6 +28,13 @@ var languages = {
         , where_remote: 'remote'
         , url: 'URL'
         , bad_url: 'URL is not valid.'
+        , auto_refresh: 'Auto refresh'
+        , last_refresh: 'Last refresh'
+        , never: 'never'
+        , hour: 'hour'
+        , hours: 'hours'
+        , day: 'day'
+        , days: 'days'
         , hide_dock_icon: 'Hide Dock Icon'
         , show_dock_icon: 'Show Dock Icon'
         , toggle_dock_icon: 'Toggle Dock Icon'
@@ -56,6 +63,13 @@ var languages = {
         , where_remote: '远程'
         , url: 'URL 地址'
         , bad_url: 'URL 地址有误。'
+        , auto_refresh: '自动更新'
+        , last_refresh: '上次更新'
+        , never: '从不'
+        , hour: '小时'
+        , hours: '小时'
+        , day: '天'
+        , days: '天'
         , hide_dock_icon: '隐藏 Dock 图标'
         , show_dock_icon: '显示 Dock 图标'
         , toggle_dock_icon: '显示/隐藏 Dock 图标'

+ 12 - 2
app/src/main.js

@@ -31,8 +31,16 @@ var app = new Vue({
             on: true,
             is_editable: false,
             where: 'sys',
-            url: ''
+            url: '',
+            refresh_interval: 24,
+            last_refresh: null
         },
+        refresh_options: [
+            [0, lang.never],
+            [1, '1 ' + lang.hour],
+            [24, '1 ' + lang.day],
+            [24 * 7, '7 ' + lang.days]
+        ],
         inform: {
             title: '',
             url: ''
@@ -182,7 +190,9 @@ var app = new Vue({
                     content: '# ' + this.current_edit_host.title,
                     on: false,
                     where: this.current_edit_host.where,
-                    url: this.current_edit_host.url
+                    url: this.current_edit_host.url,
+                    refresh_interval: this.current_edit_host.refresh_interval,
+                    last_refresh: null
                 };
                 this.hosts.list.push(host);
                 this.selectHost(host);

Some files were not shown because too many files changed in this diff