pixivã®ã¤ã©ã¹ããããã¯ãã¼ã¯ããã®ãããã¯ãã¼ã¯è¿½å ç»é¢ã«é·ç§»ããã«è¡ããã
ããããäº
- ã¤ã©ã¹ã表示ç»é¢ãããã¯ã
- ã¿ã¤ãã«ã»ãã£ãã·ã§ã³ã»ç»é²ã¿ã°ããã°ã«ã¼ããèªå追å
- éä¸è¶³åãæåã§åé¤ã»è¿½å
ä¸éããã¼ããããã£ããã°ãªã¢ã³åãããã
jQueryã使ãã¨ããã
ã¤ã©ã¹ã表示ç»é¢ã§jQueryã使ãã«ããã£ã¦ã®æ³¨æç¹
なぜか$(/*何がし*/)でindex:0に全件分のa要素が入ったjQueryオブジェクトが返ってくる件調査(jQuery AOPを使ってみた。) - 文殊堂ã§èª¿ã¹ããã
script.aculo.usã¨jQuery1.2.6ã®ãããã£ã³ã°åé¡ãããã
jQueryã«ããè¦ç´ ã®åå¾ãæ£ããè¡ããªãã®ã§ã
jQueryæ¬ä½ãä¿®æ£ãããã¾ã§ã¯jQuery.makeArrayã«ä»¥ä¸ã®ããã«ããããå½ã¦ã¦ãããªãã¨ãããªãã
jQuery.makeArray=function( array ) { var ret = []; if( array != null ){ var i = array.length; //the window, strings and functions also have 'length' if( i == null || array.split || array.setInterval || array.apply ) ret[0] = array; else while( i ) ret[--i] = array[i]; } return ret; };
ä»éãã¦ããã¤ã©ã¹ããããã¯ãã¼ã¯ãã
ã¨ããããã®ãããå°
- å ¬éè¨å®ï¼å ¬é
- ã³ã¡ã³ãï¼ç¡ã
- ã°ã«ã¼ãï¼å¼æ°dataã®groupã«åè§ã¹ãã¼ã¹åºåãã§è¨å®
illust_idã¯URLããåå¾ãã¦ãã
(function(data){ var originalData = data; data = {}; $.each(location.search.slice(1).split('&'),function(i,n){ var keyValue = n.split('='); if(keyValue[0] == 'illust_id'){ $.extend(data,{id:keyValue[1]}); } }); $.extend(data,{ mode:'add' ,type:'illust' ,restrict:'0' ,comment:'' },originalData); $.ajax({ type:'POST' ,url:'http://www.pixiv.net/bookmark_add.php' ,data:data }); })({group:'æ±æ¹ å²å¤ ã¬ããªã¢'});
ã°ã«ã¼ãä¸è¦§ã®åå¾
http://www.pixiv.net/bookmark_group_setting.phpããã¹ã¯ã¬ã¤ãã³ã°ããã
Twittelienã¨åãããã«ç©ºdivã®innerHTMLã«HTMLã代å
¥ããã®ã¯ä¸æãè¡ããªãã£ãã
var temp = $('<div/>'); temp.get(0).innerHTML = html;
ãªã®ã§ãâã®ã°ãªã¢ã³ã®101ã105è¡ç®ãåèã«ãHTMLããDocumentãªãã¸ã§ã¯ããä½ã£ã¦ã¿ãã
http://d.hatena.ne.jp/Sybian/20071217/p1
ããã¯oAutoPagerizeã®ã³ã¼ããå
ã®ããã ã
ãã以é2008/10/15ä¿®æ£
$.ajax({ type:'GET' ,url:'http://www.pixiv.net/bookmark_group_setting.php' ,success:function(html){ var frag = html.replace(/^([\n\r]|.)*?<html.*?>|<\/html([\r\n]|.)*$/ig,""); var htmlDoc=document.implementation.createDocument(null,"html",null); var r=document.createRange(); r.setStartAfter(document.body); htmlDoc.documentElement.appendChild(r.createContextualFragment(frag)); groups = $('#mypixiv_list>div[class^=bg_] a',htmlDoc).map(function(i,n){ return $(n).text(); }).get(); groups.pop(); console.info(groups); } });
mapã¡ã½ããã¨ã使ããªãã§ä»¥ä¸ã®ãããªã³ã¼ãã使ã£ã¦ããã®ã¯ã
ãªãã$(/*ä½ãã*/)ã§index:0ã«å
¨ä»¶åã®aè¦ç´ ãå
¥ã£ãjQueryãªãã¸ã§ã¯ããè¿ã£ã¦ããããã
ããã¯ãã¼ã¯ç»é²ãã¼ã¸ã ã¨æ®éã«index:0ãnã«åaè¦ç´ ãå
¥ã£ãjQueryãªãã¸ã§ã¯ããè¿ã£ã¦ããã
è¬ã ã
解決ããã®ã§ã³ã¼ããä¿®æ£ããã
ãã以é2008/10/15追è¨
ã¿ã¤ãã«ã»ã³ã¡ã³ãã»ç»é²ã¿ã°ä¸è¦§åå¾
title = $('title').text(); comment = $('#illust_comment').text(); tags = $('#tags a').map(function(i,n){ return $(n).text(); }).get();
ã¿ã¤ãã«ã»ã³ã¡ã³ãã»ç»é²ã¿ã°ä¸è¦§ã«ããã°ã«ã¼ããçµãè¾¼ã
tagPattern= new RegExp(tags.join('|'),'g'); $.grep(groups,function(n){ if(tagPattern.test(n))return true; var groupPattern = new RegExp(n,'g'); return groupPattern.test(title) || groupPattern.test(comment) ; });
TODO
- èå¿ã®ããã¯ãã¼ã¯ç»é²ç¨ã®Dialogãåºã
- ã°ã«ã¼ãä¸è¦§ãã¯ã©ã¤ã¢ã³ãå´ã§ãã£ãã·ã¥
- ãããã®éã®è¡¨è¨æºã*1対å¿ã®çºã®è¾æ¸ç»é²æ©è½
- ã°ãªã¢ã³å