)*<\/div>/g, '\n');
179 | result = result.replace(/
/g, '');
180 | /* replaces some html entities */
181 | result = result.replace(/ /g, ' ');
182 | result = result.replace(/&/g, '&');
183 | result = result.replace(/</g, '<');
184 | result = result.replace(/>/g, '>');
185 | result = result.replace(/'/g, "'");
186 |
187 | downloadFile(TITLE+".srt",result);
188 |
189 | });
190 |
191 |
192 |
193 | }
194 |
195 |
196 |
197 | // 下面这个函数不是我写的。我之前写的那种下载方法在 Chrome 更新之后失效了。不能指定下载时的文件名。
198 | // 后来搜索了下找到这个解决方案就直接复制过来用了。
199 | // 复制自: http://www.alloyteam.com/2014/01/use-js-file-download/
200 | function downloadFile(fileName, content){
201 | var aLink = document.createElement('a');
202 | var blob = new Blob([content]);
203 | var evt = document.createEvent("HTMLEvents");
204 | evt.initEvent("click", false, false);
205 | aLink.download = fileName;
206 | aLink.href = URL.createObjectURL(blob);
207 | aLink.dispatchEvent(evt);
208 | }
209 |
210 |
211 | // 处理时间. 比如 start="671.33" start="37.64" start="12" start="23.029"
212 | // 我们处理成srt的时间, 比如 00:00:00,090 00:00:08,460 00:10:29,350
213 | function process_time(s){
214 |
215 | s = s.toFixed(3);
216 | // 超棒的函数, 可以把不论是整数还是小数它都给你弄成3位小数形式的数字.
217 | // 举个柚子:
218 | // 671.33 -> 671.330
219 | // 671 -> 671.000
220 | // 注意, 这个函数会四舍五入. 具体可以去读文档
221 |
222 |
223 | var array = s.split('.');
224 | // 把开始时间根据句号分割
225 | // 671.330 会分割成数组: [671, 330]
226 |
227 |
228 | var Hour = 0;
229 | var Minute = 0;
230 | var Second = array[0]; // 671
231 | var MilliSecond = array[1]; // 330
232 | // 先声明一下变量, 待会把这几个拼好就行了。
233 |
234 |
235 |
236 | // 我们来处理秒数. 把"分钟"和"小时"除出来。
237 | if(Second >= 60){
238 |
239 | Minute = Math.floor(Second / 60);
240 | Second = Second - Minute * 60;
241 | // 我们把 秒 拆成 分钟和秒, 比如121秒, 拆成2分钟1秒
242 |
243 | Hour = Math.floor(Minute / 60);
244 | Minute = Minute - Hour * 60;
245 | // 我们把 分钟 拆成 小时和分钟, 比如700分钟, 拆成11小时40分钟
246 |
247 | }
248 |
249 |
250 | // 处理分钟,如果位数不够两位就变成两位,下面两个if语句的作用也是一样。
251 | if (Minute < 10){
252 | Minute = '0' + Minute;
253 | }
254 |
255 | // 处理小时
256 | if (Hour < 10){
257 | Hour = '0' + Hour;
258 | }
259 |
260 | // 处理秒
261 | if (Second < 10){
262 | Second = '0' + Second;
263 | }
264 |
265 | return Hour + ':' + Minute + ':' + Second + ',' + MilliSecond;
266 | }
267 |
--------------------------------------------------------------------------------
/js/GitHub-Material-Design.js:
--------------------------------------------------------------------------------
1 | // ==UserScript==
2 | // @name GitHub Material Design
3 | // @namespace http://userstyles.org
4 | // @description GitHub with Material Design styling
5 | // @author dvdandroid
6 | // @homepage https://userstyles.org/styles/123952
7 | // @include http://github.com/*
8 | // @include https://github.com/*
9 | // @include http://*.github.com/*
10 | // @include https://*.github.com/*
11 | // @run-at document-start
12 | // @version 0.20160331135937
13 | // ==/UserScript==
14 | (function() {var css = [
15 | "/*",
16 | " (c) 2012-2016 GitHub",
17 | "",
18 | " When using the GitHub logos, be sure to follow the GitHub logo guidelines (https://github.com/logos)",
19 | "",
20 | " Code License: MIT (http://choosealicense.com/licenses/mit/)",
21 | " Applies to all other files",
22 | "*/",
23 | "/*",
24 | " github-notification-bouncing",
25 | " https://github.com/muchweb/github-notification-bouncing",
26 | "*/",
27 | "",
28 | "@keyframes bounce {",
29 | " to {",
30 | " transform: scale(1.4);",
31 | " opacity: 1;",
32 | " }",
33 | "}",
34 | "@keyframes shrink {",
35 | " 0%, 50% {",
36 | " width: 14px;",
37 | " height: 14px;",
38 | " box-shadow: 0 0 8px transparent;",
39 | " }",
40 | "}",
41 | ".mail-status.unread {",
42 | " animation: bounce .5s ease-out infinite alternate, shrink 60s linear;",
43 | " width: 24px;",
44 | " height: 24px;",
45 | " opacity: 0.9;",
46 | " transform: scale(1);",
47 | " box-shadow: 0 0 8px #4183C4;",
48 | "}",
49 | "/*",
50 | " GitHub issue link inline titles",
51 | " https://userstyles.org/styles/106817/github-issue-link-inline-titles",
52 | "*/",
53 | "",
54 | ".issue-link[title]:after {",
55 | " content: attr(title);",
56 | " font-size: 0.8em;",
57 | " margin-left: 0.4em;",
58 | " margin-right: 0.6em;",
59 | " padding: 0.2em 0.4em;",
60 | " border: 1px solid #ccc;",
61 | " background: #eee;",
62 | " color: #777;",
63 | " position: relative;",
64 | " top: -1px;",
65 | "}",
66 | ".header {",
67 | " padding-top: 15px;",
68 | " padding-bottom: 15px;",
69 | "}",
70 | ".header,",
71 | ".blankslate,",
72 | ".header-logged-in,",
73 | ".org-header,",
74 | ".simple-box,",
75 | ".menu,",
76 | ".capped-card,",
77 | ".file-header,",
78 | ".file,",
79 | ".network-graph-container,",
80 | ".js-code-editor,",
81 | ".container-preview,",
82 | ".show-code,",
83 | ".auth-form-body,",
84 | ".repohead.experiment-repo-nav,",
85 | ".file-wrap,",
86 | ".branch-infobar,",
87 | ".commit-tease,",
88 | ".stats-switcher-viewport,",
89 | ".table-list,",
90 | ".table-list-header,",
91 | ".new-user-avatar-cta,",
92 | ".comment,",
93 | ".previewable-edit,",
94 | ".timeline-comment,",
95 | ".js-comment,",
96 | ".js-task-list-container,",
97 | ".owner-comment,",
98 | ".current-user,",
99 | ".activity-listing.contribution-activity.js-contribution-activity,",
100 | ".boxed-group {",
101 | " box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2) !important;",
102 | "}",
103 | ".header-nav-link {",
104 | " margin-top: 5px;",
105 | "}",
106 | ".header-logo-invertocat {",
107 | " margin-top: 3px;",
108 | "}",
109 | ".site-search,",
110 | "#your-repos-filter,",
111 | ".input-block,",
112 | ".filter_input,",
113 | ".short,",
114 | ".js-repository-name,",
115 | ".js-filterable-field,",
116 | ".select,",
117 | ".subnav-search-input,",
118 | ".input-contrast,",
119 | ".auto-search-input,",
120 | ".js-autosearch-field,",
121 | ".js-member-filter-field,",
122 | ".filename,",
123 | ".js-gist-filename,",
124 | ".js-blob-filename,",
125 | "#user_profile_name,",
126 | "#user_profile_blog,",
127 | "#user_profile_company,",
128 | "#user_profile_location,",
129 | "#user_old_password,",
130 | "#user_new_password,",
131 | "#user_confirm_new_password,",
132 | "#q {",
133 | " font-size: 14px;",
134 | " border-color: transparent !important;",
135 | " box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 1px rgba(0, 0, 0, .12) !important;",
136 | " -webkit-transition: box-shadow .2s !important;",
137 | " transition: box-shadow .2s !important;",
138 | " border-radius: 2px !important;",
139 | " box-sizing: border-box !important;",
140 | " background: white;",
141 | "}",
142 | "#rename_field {",
143 | " line-height: 8px !important;",
144 | "}",
145 | ".form-control {",
146 | " padding: 5px 8px;",
147 | " margin: 1px;",
148 | "}",
149 | ".form-control > input {",
150 | " border-color: transparent!important;",
151 | " line-height: 40px!important;",
152 | " height: 40px!important;",
153 | " box-shadow: 0 1px 1.5px rgba(0, 0, 0, .06), 0 1px 1px rgba(0, 0, 0, .12)!important;",
154 | " -webkit-transition: box-shadow .2s!important;",
155 | " transition: box-shadow .2s!important;",
156 | " border-radius: 2px!important;",
157 | " box-sizing: border-box!important;",
158 | " background: #fff!important;",
159 | " padding: 5px;",
160 | "}",
161 | ".form-control,",
162 | ".form-select {",
163 | " border: 0;",
164 | " height: 40px!important;",
165 | "}",
166 | ".header-search-wrapper {",
167 | " display: inline;",
168 | "}",
169 | ".form-control.focus,",
170 | ".form-control:focus,",
171 | ".form-select.focus,",
172 | ".form-select:focus {",
173 | " border: 0;",
174 | " outline: none;",
175 | " box-shadow: none;",
176 | "}",
177 | ".form-control {",
178 | " padding: 0;",
179 | " margin: 0;",
180 | "}",
181 | ".site-search .chromeless-input {",
182 | " width: 260px;",
183 | " height: 30px !important;",
184 | " min-height: 0;",
185 | "}",
186 | ".site-search .scope-badge {",
187 | " margin-left: 1px;",
188 | " padding: 0 5px;",
189 | " line-height: 26px;",
190 | " vertical-align: initial;",
191 | "}",
192 | ".subnav-search-input,",
193 | ".input-contrast,",
194 | ".auto-search-input,",
195 | ".js-repo-filter-field,",
196 | ".js-autosearch-field,",
197 | ".site-search form {",
198 | " width: 360px;",
199 | " padding-right: 2px;",
200 | " margin-right: 0;",
201 | "}",
202 | ".form-control.focus,",
203 | ".form-control:focus,",
204 | "input[type=\"text\"].focus,",
205 | "input[type=\"text\"]:focus,",
206 | ".focused .drag-and-drop,",
207 | "input[type=\"password\"].focus,",
208 | "input[type=\"password\"]:focus,",
209 | "input[type=\"email\"].focus,",
210 | "input[type=\"email\"]:focus,",
211 | "input[type=\"number\"].focus,",
212 | "input[type=\"number\"]:focus,",
213 | "input[type=\"tel\"].focus,",
214 | "input[type=\"tel\"]:focus,",
215 | "input[type=\"url\"].focus,",
216 | "input[type=\"url\"]:focus,",
217 | "select.focus,",
218 | "select:focus,",
219 | "textarea.focus,",
220 | "textarea:focus {",
221 | " border-color: #fff;",
222 | " box-shadow: none;",
223 | "}",
224 | ".btn,",
225 | ".subnav-item,",
226 | ".state,",
227 | ".btn-sm {",
228 | " box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 1px rgba(0, 0, 0, .12) !important;",
229 | " text-decoration: none;",
230 | " text-align: center;",
231 | " letter-spacing: 0;",
232 | " transition: .2s ease-in;",
233 | " cursor: pointer;",
234 | " display: inline-block;",
235 | "}",
236 | "input.btn {",
237 | " padding: 6px 8px;",
238 | "}",
239 | ".btn-primary,",
240 | ".btn-primary:hover {",
241 | " background-image: linear-gradient(#66BB6A, #4CAF50);",
242 | "}",
243 | ".profilecols .filter-bar {",
244 | " padding: 15px 8px 15px;",
245 | "}",
246 | ".tabnav {",
247 | " padding-bottom: 0;",
248 | " margin-bottom: 0;",
249 | "}",
250 | "body.page-profile .tab-content {",
251 | " padding-bottom: 15px;",
252 | "}",
253 | ".repo-list-item {",
254 | " padding: 30px 20px 30px 20px;",
255 | "}",
256 | ".activity-tab {",
257 | " padding-top: 15px;",
258 | "}",
259 | ".pagehead {",
260 | " padding-bottom: 0;",
261 | "}",
262 | ".tabnav-tab,",
263 | ".pagehead-tabs-item,",
264 | ".reponav-item,",
265 | ".pagehead-nav-item {",
266 | " padding: 15px 12px;",
267 | " height: 54px;",
268 | " text-transform: uppercase;",
269 | "}",
270 | ".tabnav-tabs,",
271 | ".pagehead-tabs {",
272 | " margin-bottom: 0;",
273 | "}",
274 | ".tabnav-tab.selected,",
275 | ".pagehead-tabs-item.selected,",
276 | "a.repo-filter.text-small.text-muted.js-repo-filter-tab.filter-selected,",
277 | ".reponav-item.selected,",
278 | ".pagehead-nav-item.selected {",
279 | " background-color: #f0f0f0 !important;",
280 | " border-top: 0;",
281 | " border-left: 0;",
282 | " border-right: 0;",
283 | " border-bottom: 3px solid #4285f4;",
284 | " color: #4285f4;",
285 | " margin: 2px 4px 0;",
286 | "}",
287 | ".activity-listing.contribution-activity.js-contribution-activity {",
288 | " padding: 15px;",
289 | " border-radius: 4px;",
290 | "}",
291 | "div.select-menu.right.js-menu-container.js-select-menu.js-period-container {",
292 | " padding-top: 25px;",
293 | "}",
294 | ".state {",
295 | " text-transform: uppercase;",
296 | " padding: 3px;",
297 | "}",
298 | ".state-closed,",
299 | ".bar-section-negative {",
300 | " background-color: #E53935 !important;",
301 | "}",
302 | ".state-merged,",
303 | ".bar-section-alt {",
304 | " background-color: #7B1FA2 !important;",
305 | "}",
306 | ".state-open,",
307 | ".bar-section-positive {",
308 | " background-color: #43A047 !important;",
309 | "}"
310 | ].join("\n");
311 | if (typeof GM_addStyle != "undefined") {
312 | GM_addStyle(css);
313 | } else if (typeof PRO_addStyle != "undefined") {
314 | PRO_addStyle(css);
315 | } else if (typeof addStyle != "undefined") {
316 | addStyle(css);
317 | } else {
318 | var node = document.createElement("style");
319 | node.type = "text/css";
320 | node.appendChild(document.createTextNode(css));
321 | var heads = document.getElementsByTagName("head");
322 | if (heads.length > 0) {
323 | heads[0].appendChild(node);
324 | } else {
325 | // no head yet, stick it whereever
326 | document.documentElement.appendChild(node);
327 | }
328 | }
329 | })();
330 |
--------------------------------------------------------------------------------