fix single bare page link
This commit is contained in:
parent
7f1fdf441f
commit
4efd73d37a
1 changed files with 24 additions and 22 deletions
|
@ -72,16 +72,16 @@ var Gogits = {
|
||||||
prettyPrint();
|
prettyPrint();
|
||||||
|
|
||||||
var $lineNums = $pre.parent().siblings('.lines-num');
|
var $lineNums = $pre.parent().siblings('.lines-num');
|
||||||
if($lineNums.length > 0){
|
if ($lineNums.length > 0) {
|
||||||
var nums = $pre.find('ol.linenums > li').length;
|
var nums = $pre.find('ol.linenums > li').length;
|
||||||
for(var i=0;i < nums;i++){
|
for (var i = 0; i < nums; i++) {
|
||||||
$lineNums.append('<span id="L'+i+'" rel=".L'+i+'">'+(i+1)+'</span>');
|
$lineNums.append('<span id="L' + i + '" rel=".L' + i + '">' + (i + 1) + '</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
var last;
|
var last;
|
||||||
$(document).on('click', '.lines-num span', function(){
|
$(document).on('click', '.lines-num span', function () {
|
||||||
var $e = $(this);
|
var $e = $(this);
|
||||||
if(last){
|
if (last) {
|
||||||
last.removeClass('active');
|
last.removeClass('active');
|
||||||
}
|
}
|
||||||
last = $e.parent().siblings('.lines-code').find('ol.linenums > ' + $e.attr('rel'));
|
last = $e.parent().siblings('.lines-code').find('ol.linenums > ' + $e.attr('rel'));
|
||||||
|
@ -96,12 +96,12 @@ var Gogits = {
|
||||||
var node = $(this);
|
var node = $(this);
|
||||||
var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-'));
|
var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-'));
|
||||||
var name = val;
|
var name = val;
|
||||||
if(headers[val] > 0){
|
if (headers[val] > 0) {
|
||||||
name = val + '-' + headers[val];
|
name = val + '-' + headers[val];
|
||||||
}
|
}
|
||||||
if(headers[val] == undefined){
|
if (headers[val] == undefined) {
|
||||||
headers[val] = 1;
|
headers[val] = 1;
|
||||||
}else{
|
} else {
|
||||||
headers[val] += 1;
|
headers[val] += 1;
|
||||||
}
|
}
|
||||||
node = node.wrap('<div id="' + name + '" class="anchor-wrap" ></div>');
|
node = node.wrap('<div id="' + name + '" class="anchor-wrap" ></div>');
|
||||||
|
@ -181,20 +181,22 @@ function initUserSetting() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initRepository() {
|
function initRepository() {
|
||||||
var $guide = $('.guide-box');
|
(function () {
|
||||||
if ($guide.length) {
|
var $guide = $('.guide-box');
|
||||||
var $url = $('#guide-clone-url');
|
if ($guide.length) {
|
||||||
$guide.find('button[data-url]').on("click",function () {
|
var $url = $('#guide-clone-url');
|
||||||
var $this = $(this);
|
$guide.find('button[data-link]').on("click",function () {
|
||||||
if (!$this.hasClass('btn-primary')) {
|
var $this = $(this);
|
||||||
$guide.find('.btn-primary').removeClass('btn-primary').addClass("btn-default");
|
if (!$this.hasClass('btn-primary')) {
|
||||||
$(this).addClass('btn-primary').removeClass('btn-default');
|
$guide.find('.btn-primary').removeClass('btn-primary').addClass("btn-default");
|
||||||
$url.val($this.data("url"));
|
$(this).addClass('btn-primary').removeClass('btn-default');
|
||||||
$guide.find('span.clone-url').text($this.data('url'));
|
$url.val($this.data("link"));
|
||||||
}
|
$guide.find('span.clone-url').text($this.data('link'));
|
||||||
}).eq(0).trigger("click");
|
}
|
||||||
// todo copy to clipboard
|
}).eq(0).trigger("click");
|
||||||
}
|
// todo copy to clipboard
|
||||||
|
}
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
(function ($) {
|
(function ($) {
|
||||||
|
|
Reference in a new issue