Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove unused functions (#1590) #1698

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
{% endif %}

<script data-cfasync="false" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script data-cfasync="false" src="/js/ismobile.js"></script>
<script data-cfasync="false" src="/js/app.js"></script>
<script data-cfasync="false" defer src="/js/menu.js"></script>
<script data-cfasync="false" src="/js/retina.js"></script>
Expand Down
76 changes: 9 additions & 67 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

bjohansebas marked this conversation as resolved.
Show resolved Hide resolved
$(function(){
var doc = $(document);
var lang = document.location.pathname.split('/')[1]

// top link
bjohansebas marked this conversation as resolved.
Show resolved Hide resolved
$('#top').click(function(e){
Expand All @@ -26,34 +25,6 @@ $(function(){
}
})

// edit page link
var latest = '';
var branchPath = 'https://github.com/expressjs/expressjs.com';
var pathName = document.location.pathname;

var currentVersion = (pathName.match(/^(?:\/[a-z]{2})?\/([0-9]x|)/) || [])[1] || '4x'; // defaults to current version
var fileName = pathName.split('/').splice(-2)[1];
var pagePath;
var editPath;

// the api doc cannot be edited individually, we'll have to link to the dir instead
if (fileName == 'api.html') {
editPath = branchPath + '/tree/gh-pages/_includes/api/en/'+ currentVersion;
}
// link to individual doc files
else {
pagePath = pathName.replace(/\.html$/, '.md');
editPath = branchPath + '/blob/gh-pages' + pagePath;
}

var editLink;

if (lang === 'en') {
if (pathName == '/') editLink = '<a href="' + branchPath + '">Fork the website on GitHub</a>.';
else editLink = '<a href="' + editPath + '">Edit this page on GitHub</a>.';
$('#fork').html(editLink);
}

// code highlight

$('code.language-js').each(function(){
bjohansebas marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -68,9 +39,6 @@ $(function(){

// menu bar

var prev;
var n = 0;

var headings = $('h2, h3').map(function(i, el){
bjohansebas marked this conversation as resolved.
Show resolved Hide resolved
return {
top: $(el).offset().top - 200,
Expand Down Expand Up @@ -99,50 +67,25 @@ $(function(){
});

$(document).scroll(function() {
bjohansebas marked this conversation as resolved.
Show resolved Hide resolved

var h = closest();
if (!h) return;

currentApiPrefix = h.id.split('.')[0];
parentMenuSelector = '#'+ currentApiPrefix + '-menu';

if (window.location.pathname == '/3x/api.html') {

if (prev) {
prev.removeClass('active');
prev.parent().parent().removeClass('active');
}
var a = $('a[href="#' + h.id + '"]');
a.addClass('active');
a.parent().parent().addClass('active');
prev = a;
$(parentMenuSelector).addClass('active');

if (lastApiPrefix && (lastApiPrefix != currentApiPrefix)) {
$('#'+ lastApiPrefix + '-menu').removeClass('active');
}

else {

currentApiPrefix = h.id.split('.')[0];
parentMenuSelector = '#'+ currentApiPrefix + '-menu';

$(parentMenuSelector).addClass('active');

if (lastApiPrefix && (lastApiPrefix != currentApiPrefix)) {
$('#'+ lastApiPrefix + '-menu').removeClass('active');
}

$('#menu li a').removeClass('active');
$('#menu li a').removeClass('active');

var a = $('a[href="#' + h.id + '"]');
a.addClass('active');

lastApiPrefix = currentApiPrefix.split('.')[0];

}
var a = $('a[href="#' + h.id + '"]');
a.addClass('active');

lastApiPrefix = currentApiPrefix.split('.')[0];
})
$('#tags-side-menu li').on('click', function() {
// Remove prev 'active's
$(this).next().siblings().removeClass('active');
$(this).next().addClass('active')
})

// i18n notice
if (readCookie('i18nClose')) {
bjohansebas marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -154,7 +97,6 @@ $(function(){
createCookie('i18nClose', 1);
})
}

})


Expand Down
1 change: 0 additions & 1 deletion js/ismobile.js

This file was deleted.