TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

YC Apply Auto-Save Bookmarklet

2 点作者 nicholasreed大约 14 年前
YC Apply Auto-save<p>Save the following Javascript as a bookmarklet.<p>javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g&#62;f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&#38;&#38;(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){var myRegExp = /ews.ycombinator.com/;var string1 = document.domain;var matchPos1 = string1.search(myRegExp);if(matchPos1 != 1){$('body').prepend("&#60;div class='autosaveBodyTopLeft' style='z-index:10000;position:fixed;top:0;left:0;width:auto;background:red;color:white;'&#62;You are not on the YC Apply page! (we think, but may be wrong here)&#60;/div&#62;");return;}$('body').prepend("&#60;div class='autosaveBodyTopLeft' style='position:fixed;top:0;left:0;width:auto;background:blue;color:white;'&#62;YC Apply Auto-save&#60;/div&#62;");var isKeypressed = 1;var isSaving = 0;var keyWas = 1;$('input').keypress(function(){isKeypressed = 1;keyWas = 1;});$('textarea').keypress(function(){isKeypressed = 1;keyWas = 1;});$('select').change(function(){isKeypressed = 1;keyWas = 1;});var lastPostData = {};window.setInterval(function(){if(isSaving){return;}if(isKeypressed == 0){if(keyWas == 0){return;}keyWas = 0;}var postData = {};$('input').each(function(index){postData[$(this).attr('name')] = $(this).val();});$('textarea').each(function(index){postData[$(this).attr('name')] = $(this).val();});$('select').each(function(index){postData[$(this).attr('name')] = $(this).find('option:selected').text();});tempPostData = JSON.stringify(postData);if(lastPostData == tempPostData){return;}lastPostData = tempPostData;var url = $('form').attr('action');isSaving = 1;$.ajax({url: url,cache: false,data: postData,type: 'post',dataType: 'html',success: function(responseHtml){isSaving = 0;isKeypressed = 0;}});},10000);});<p>When you are on the YC Apply page, click the bookmarlet you, or just copy/paste the Javascript into the URL.<p>It checks for new post data every 10 seconds, and updates if necessary.

暂无评论

暂无评论