正在查看 5 個帖子:1-5 (共 5 個帖子)
-
作者帖子
-
dz.gg 短網址系統優化修改代碼合集,方便後續用户自行升級和個性化修改;
這是我去年做的一個項目,一直都沒怎麼用,所以就想幹脆開源吧,分享出來,但是工作很多做好了頁面就沒時間更新代碼了,
現在發現找短網址系統的都是到了我們這裏,但是沒得下載,這幾天思緒比較亂,
諮詢客服的用户也比較多就又花了些時間進行了升級,預計最遲就這幾天發佈。
1 、讓後台的 favicon 顯示正常
大致在 /includes/functions-infos.php 文件的 224 行
/** * Return favicon URL * */ function yourls_get_favicon_url( $url ) { return yourls_match_current_protocol( 'https://www.google.com/s2/favicons?domain=' . yourls_get_domain( $url, false ) ); }
/** * Return favicon URL * */ function yourls_get_favicon_url( $url ) { return yourls_match_current_protocol( 'https://api.byi.pw/favicon/?url=' . yourls_get_domain( $url, false ) ); }
原文丟失,這又是一段一段的從新寫上來;
2 、替換後台 Google 圖表顯示
大致在 includes/functions-html.php 文件的 116 行
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
替換為
<script type="text/javascript" src="https://ajax.lug.ustc.edu.cn/jsapi"></script>
方法不完美,將就着用吧
此回覆已被標記為私有,🔒 僅樓主及管理員可見。3 、替換分享框為國內服務
大致在 includes/functions-html.php 文件的 398 行
<div id="sharebox" class="share"> <?php echo $share_title; ?> <div id="tweet"> <span id="charcount" class="hide-if-no-js"><?php echo $count; ?></span> <textarea id="tweet_body"><?php echo $share; ?></textarea> </div> <p id="share_links"><?php yourls_e( 'Share with' ); ?> <a id="share_tw" href="https://twitter.com/home?status=<?php echo $_share; ?>" title="<?php yourls_e( 'Tweet this!' ); ?>" onclick="share('tw');return false">Twitter</a> <a id="share_fb" href="https://www.facebook.com/share.php?u=<?php echo $_url; ?>" title="<?php yourls_e( 'Share on Facebook' ); ?>" onclick="share('fb');return false;">Facebook</a> <?php yourls_do_action( 'share_links', $longurl, $shorturl, $title, $text ); // Note: on the main admin page, there are no parameters passed to the sharebox when it's drawn. ?> </p> </div>
替換為
<div id="sharebox" class="share"> <?php echo $share_title; ?> <div id="tweet"> <span id="charcount" class="hide-if-no-js"><?php echo $count; ?></span> <textarea id="tweet_body"><?php echo $share; ?></textarea> </div> <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"> 分享到:</a><a href="#" class="bds_qzone" data-cmd="qzone" title=" 分享到 QQ 空間"> 空間 </a><a href="#" class="bds_tsina" data-cmd="tsina" title=" 分享到新浪微博"> 微博 </a><a href="#" class="bds_tieba" data-cmd="tieba" title=" 分享到百度貼吧"> 貼吧 </a> <a href="#" class="bds_weixin" data-cmd="weixin" title=" 分享到微信"> 微信</a></div> </div>
使用百度分享替換。
補充下記得加上 百度分享 js 代碼不然不會顯示。
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"2","bdSize":"16"},"share":{"bdSize":16}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='https://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
-
作者帖子
正在查看 5 個帖子:1-5 (共 5 個帖子)
- 話題 「dz.gg 短網址系統優化修改代碼合集」 已關閉,不接受新回覆。