ade's profile欢迎光临阿德咖吧PhotosBlogLists Tools Help
    6/17/2006

    日志界面切换

      Spaces把每个人的地址都换掉了,那么原来人家做的那个可以在日志编辑界面和浏览界面切换的JS现在就不能用了。于是仿照前人的作品,改了一下,就是下面这段。

    javascript:l=window.location.href;s=l.replace(/.*(cns!.{16}!\d{3}).*/i,"$1");window.location=l.replace(/(.*\.com\/).*/i,"$1")+(l.match(/\/blog\//i)?"PersonalSpace.aspx?_c11_BlogPart_blogpart=blogentry&_c=BlogPart&_c02_owner=1&handle="+s:"blog/"+s+".entry")

      把它复制到地址栏按回车,或是加在收藏夹里使用就可以了。比如我现在这篇日志的固定链接为“http://agreencandle.spaces.msn.com/Blog/cns!F47F3DB8470E40EE!725.entry”,而编辑这篇日志的地址为“http://agreencandle.spaces.msn.com/PersonalSpace.aspx?_c11_BlogPart_blogpart=blogentry&_c=BlogPart&_c02_owner=1&handle=cns!F47F3DB8470E40EE!725”,以上那段JS就是在这两者间切换用的,主要还是从浏览切到编辑比较实用。还有一个前提是只限该Spaces用户本人使用,而且在已登录的情况下。

      其实没学过JS,所以写得比较难看,嘿嘿。现在并在一行里简化了,原来的样子如下,请大家多多指教。

    javascript:
    try
    {
     l=window.location.href;
      s=l.replace(/.*(cns![^!]{16}!\d{3}).*/i,"$1");
      window.location=
      l.replace(/(.*\.com\/).*/i,"$1")+
      (
       l.match(/\/blog\//i)
       ?
          "PersonalSpace.aspx?"+
            "_c11_BlogPart_blogpart=blogentry"+
            "&"+
            "_c=BlogPart"+
            "&"+
            "_c02_owner=1"+
            "&"+
            "handle="+
            s
       :
          " blog/"+
         s+
          ".entry"
      )
     ;
    }
    catch(e)
    {
    }


    附两个人家写的脚本,可惜MSN改版后不能用了。也不知道能不能改。

    打开所有日志评论:
    javascript:try{d=document.all("BlogViewId").getElementsByTagName("div");for(i=0;i<d.length;i++){if(d[i].id.indexOf("entrycns!")==0)void(OpenSection("comment",d[i].id.substr(5)))}}catch(e){}

    关闭所有日志评论:
    javascript:try{d=document.all("BlogViewId").getElementsByTagName("div");for(i=0;i<d.length;i++){if(d[i].id.indexOf("entrycns!")==0)void(Close("comment",d[i].id.substr(5)))}}catch(e){}

    Comments (4)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Apr. 13
    Peter Shanwrote:
    为什么我都能用?
    奇怪,连原来的链接地址输进去都能显示
    还自动改链接地址的
    June 27
    ZikkiE Ginwrote:
    @@
    好麻烦啦~~
     
    June 17
    Ban Banwrote:
    我觉得space那些技巧好难@_@
     
    June 17

    Trackbacks

    Weblogs that reference this entry
    • None