收听之前显示“收听TA” 收听之后显示“取消收听”。
<!--{eval $follow = 0;}-->
<!--{eval $follow = C::t('home_follow')->fetch_all_by_uid_followuid($_G['uid'], 对方uid);}-->
<a href="home.php?mod=spacecp&ac=follow&op={if !empty($follow)}del{else}add{/if}&hash={FORMHASH}&fuid=对方uid" id="followmod_对方uid" onclick="showWindow('followmod', this.href, 'get', 0)"><!--{if !empty($follow)}-->{lang nofollow}<!--{else}-->{lang follow}<!--{/if}--></a>

与之相关的自带的js
function succeedhandle_followmod(url, msg, values) {
  var fObj = $('followmod_'+values['fuid']);
  if(values['type'] == 'add') {
    fObj.innerHTML = '{lang nofollow}';
    fObj.href = 'home.php?mod=spacecp&ac=follow&op=del&fuid='+values['fuid'];
  } else if(values['type'] == 'del') {
    fObj.innerHTML = '{lang follow}';
    fObj.href = 'home.php?mod=spacecp&ac=follow&op=add&hash={FORMHASH}&fuid='+values['fuid'];
  }
}

home里的
space_userabout.htm里也有,和上面的代码形式相同。
{lang }有区别,取消收听{lang follow_del},收听{lang follow_add}TA。
space_card也有这个东西,但是代码稍有不同,不同uid有区分,如下。
<!--{if helper_access::check_module('follow')}-->
<a href="home.php?mod=spacecp&ac=follow&op={if !empty($follow)}del{else}add{/if}&hash={FORMHASH}&fuid=$space[uid]" id="card_followmod_$space[uid]" onclick="showWindow(this.id, this.href, 'get', 0)" class="xi2"><!--{if !empty($follow)}-->{lang follow_del}<!--{else}-->{lang follow_add}TA<!--{/if}--></a>
<!--{/if}-->
<script type="text/javascript">
        function succeedhandle_card_followmod_$space[uid](url, msg, values) {
          var linkObj = $('card_followmod_'+values['fuid']);
          if(linkObj) {
            if(values['type'] == 'add') {
              linkObj.innerHTML = '{lang follow_del}';
              linkObj.href = 'home.php?mod=spacecp&ac=follow&op=del&fuid='+values['fuid'];
            } else if(values['type'] == 'del') {
              linkObj.innerHTML = '{lang follow_add}TA';
              linkObj.href = 'home.php?mod=spacecp&ac=follow&op=add&hash={FORMHASH}&fuid='+values['fuid'];
            }
          }
        }
      </script>

声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:123456@qq.com 我们将配合处理!

原文地址:discuz 收听和取消收听切换按钮发布于2023-04-05 20:44:09

相关推荐