Changeset 20041 for websites

Show
Ignore:
Timestamp:
09/27/08 16:27:58 (2 months ago)
Author:
NeoCat
Message:

add popup menu for each message

Location:
websites/twicli
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • websites/twicli/favotter.js

    r19685 r20041  
    66                if (this.cnt++ < 5) return; 
    77                this.cnt = 0; 
    8                 this.fav_update = loadXDomainScript('nr_favs.js?seq='+(seq++), this.fav_update); 
     8                this.fav_update = loadXDomainScript('http://www.geocities.jp/twicli/nr_favs.js?seq='+(seq++), this.fav_update); 
    99        }, 
    1010        newMessageElement: function(ele, tw) { 
     
    1515                if (this.favs[tw.id]) { 
    1616                        fele.style.fontSize = "small"; 
    17                         fele.style.color = "#092"; 
     17                        fele.style.backgroundColor = "#3fc"; 
    1818                        fele.innerHTML = '[fav:' + this.favs[tw.id] + '] '; 
    1919                } 
    2020                ele.insertBefore(fele, ele.childNodes[4]); 
    2121        }, 
     22        popup: function(ele, user, id) { 
     23                $('favotter_link_user').href = 'http://favotter.matope.com/user.php?user=' + user; 
     24                $('favotter_link_status').href = 'http://favotter.matope.com/status.php?id=' + id; 
     25                $('favotter_link_fav').href = 'http://favotter.matope.com/user.php?mode=fav&user=' + user; 
     26        } 
    2227}; 
    2328registerPlugin(twFavPlugin); 
     
    3136        } 
    3237} 
     38 
     39// Popup menu 
     40 
     41var a = document.createElement("hr"); 
     42$('popup').appendChild(a) 
     43 
     44a = document.createElement("a"); 
     45a.target = 'twitter'; 
     46a.id = 'favotter_link_user'; 
     47a.innerHTML = 'ふぁぼったー / ふぁぼられ'; 
     48$('popup').appendChild(a) 
     49 
     50a = document.createElement("a"); 
     51a.target = 'twitter'; 
     52a.id = 'favotter_link_status'; 
     53a.innerHTML = 'ふぁぼったー / 発言'; 
     54$('popup').appendChild(a) 
     55 
     56a = document.createElement("a"); 
     57a.target = 'twitter'; 
     58a.id = 'favotter_link_fav'; 
     59a.innerHTML = 'ふぁぼったー / ふぁぼり'; 
     60$('popup').appendChild(a) 
     61 
     62 
  • websites/twicli/twicli.html

    r19732 r20041  
    1212 
    1313#control { position: fixed; top: 0; left: 0; width: 100%; height: 52px; border-bottom: solid 1px black; background-color: white; z-index: 3; background-color: #eee; } 
    14 #loading { opacity: 0.5; position: absolute; top: 6px; width: 100%; height: 20px; z-index: 3; text-align: center; } 
     14#loading { opacity: 0.5; position: absolute; top: 6px; width: 100%; height: 20px; z-index: 4; text-align: center; } 
    1515#fst { position: absolute; left: 1px; top: 1px; width: 94%; height: 30px; font-size: small; } 
    1616#go { text-decoration: none; position: absolute; left: 95%; top: 1px; } 
     
    2626.dir { color: #679; } 
    2727.status { text-decoration: none; color: black; } 
     28.utils { white-space: nowrap; text-align: right } 
    2829.prop, .prop a { color: #999; font-size: x-small; } 
    2930.fromme { background-color: #cfc; } 
     
    3132.button { color: #f29; border: solid 1px #ddd; text-decoration: none; font-size: medium; } 
    3233.green { color: #195; } 
     34.popup { padding: 0 4px; color: #888; } 
    3335.lock { position: relative; top: 2px; left: 0; } 
    3436.close { color: red; } 
    3537#next { text-align: center; background-color: #999; color: #fec; cursor: pointer; } 
    3638#rep { display: none; background-color: #fee; position: absolute; width: 90%; left: 4%; top: 200px; border: #666 4px solid; z-index: 2; padding: 2px; font-size: small; } 
     39#popup { display: none; background-color: #eee; position: absolute; left: 0; top: 200px; border: #666 2px solid; z-index: 6; font-size: small; } 
     40#popup a { display: block; background-color: #fff; color: black; text-decoration: none; padding: 3px; border-bottom: solid 1px #888; } 
     41#popup a:hover { background-color: #33f; color: #fff; text-decoration: none; } 
     42#popup a.row2 { background-color: #eee; } 
     43#popup_hide { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.1; background-color: black; z-index: 5; } 
    3744#user_info { margin: 1px; border: solid 1px #888; } 
    3845#user_info td { font-size: small; } 
     
    190197</div> 
    191198</div> 
    192 <!--タイムライン--> 
     199<!--メインタイムライン--> 
    193200<div id="tw"></div> 
     201<!--TL以外のタブ--> 
    194202<div id="tw2"><div id="tw2h"></div><div id="tw2c"></div></div> 
     203<!--返信--> 
    195204<div id="rep"><a href="javascript:closeRep()" class="close">[x]</a> 
    196205        <a href="javascript:pickup2()" class="close">[⇔]</a><div id="reps"></div></div> 
    197 <!----> 
     206<!--ポップアップメニュー--> 
     207<div id="popup" onClick="popup_hide()"> 
     208<a id="popup_link_user" href="" target="twitter">Twitter / User</a> 
     209<a id="popup_link_status" href="" target="twitter">Twitter / Status</a> 
     210</div> 
     211<!--ポップアップメニュー非表示用--> 
     212<div id="popup_hide" onClick="popup_hide();"></div> 
    198213 
    199214<script type="text/javascript"> 
     
    219234var user_pick1 = null; 
    220235var user_pick2 = null; 
     236var user_popup = null; 
    221237var cur_page = 1; 
    222238var fav_mode = 0; 
    223239var reply_ele = false; 
    224240var rep_top = 0; 
     241var popup_top = 0; 
    225242var selected_menu = $("TL"); 
    226243var failover_timeout = false; 
     
    306323        switchUser(user_pick1 + "," + user_pick2); 
    307324} 
     325// ポップアップメニューを表示 
     326function popup(user, id, ele) { 
     327        user_popup = user; 
     328        callPlugins("popup", $('popup'), user, id); 
     329        $('popup_link_user').href = 'http://twitter.com/' + user; 
     330        $('popup_link_status').href = 'http://twitter.com/' + user + '/statuses/' + id; 
     331        $('popup').style.display = "block"; 
     332        var pos = cumulativeOffset(ele); 
     333        $('popup').style.left = pos[0] <  $('popup').offsetWidth - ele.offsetWidth ? 0 : pos[0] - $('popup').offsetWidth + ele.offsetWidth; 
     334        $('popup').style.top = popup_top = pos[1] + 20; 
     335        $('popup_hide').style.height = document.body.scrollHeight; 
     336        $('popup_hide').style.display = "block"; 
     337} 
     338// ポップアップメニューを非表示 
     339function popup_hide() { 
     340        $('popup').style.display = 'none'; 
     341        $('popup_hide').style.display = 'none' 
     342} 
    308343// 最新タイムラインを取得 
    309344update = function() { 
     
    324359                        //ユーザアイコン 
    325360                        (tw.user.url ? '<a target="twitter" href="'+tw.user.url+'">' : '') + 
    326                         '<img align="left" width="24" height="24" src="' + tw.user.profile_image_url + '">' + (tw.user.url ? '</a>' : '') + 
     361                        '<img align="left" width="32" height="32" src="' + tw.user.profile_image_url + '">' + (tw.user.url ? '</a>' : '') + 
    327362                        //名前 
    328363                        "<a href=\"http://twitter.com/" + un + "\" "+ "onClick=\"switchUser('" + un + "');return false\">" + un + 
     
    336371                                .replace(/@([\w-]+)/g, "<a href=\"http://twitter.com/$1\" onClick=\"switchUser('$1'); return false;\" >$&</a>").replace(/\r?\n|\r/g, "<br>") + '</span>' + 
    337372                //日付'クライアント 
    338                 ' <span class="prop">' + dateFmt(new Date(tw.created_at)) + ' / ' + tw.source + '</span>' + 
     373                ' <span class="utils"><span class="prop">' + dateFmt(new Date(tw.created_at)) + ' / ' + tw.source + '</span>' + 
    339374                //返信先を設定 
    340375                ' <a class="button green" href="javascript:replyTo(\'' + un + "'," + tw.id + ')">↩</a>' + 
    341376                //返信元へのリンク 
    342377                (tw.in_reply_to_status_id ? ' <a class="button" href="#" onClick="dispReply(\'' + un + '\',' + tw.in_reply_to_status_id + ',this); return false;">☞</a>' : '') + 
    343                 '<br clear="left">'; 
     378                //popupメニュー表示 
     379                ' <a class="button popup" href="#" onClick="popup(\'' + un + "'," + tw.id + ', this); return false;"><small><small>▼</small></small></a>' + 
     380                '</span><br clear="left">'; 
    344381} 
    345382// ユーザ情報のHTML表現を生成 
     
    491528        else if (animation) { 
    492529                $('rep').style.top = (rep_top += pNode.clientHeight+1); 
     530                $('popup').style.top = (popup_top += pNode.clientHeight+1); 
    493531                scrollBy(0, pNode.clientHeight+1); 
    494532        } 
     
    655693if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false); 
    656694window.onmousewheel = document.onmousewheel = wheel; 
    657 loadXDomainScript('http://twitter.com/statuses/user_timeline.json?count=1&callback=twUser&seq=' + (seq++)); 
     695loadXDomainScript('http://twitter.com/statuses/user_timeline.json?count=1&callback=twUser'); 
    658696</script> 
    659697</body>