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

Remove unused methods and variables #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
26 changes: 1 addition & 25 deletions reply-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,6 @@ function loadReplyLink( $, mw ) {
.replace( /([«‹])\xA0/g, "$1 " );
}

/**
* Remove duplicates from an array.
* https://stackoverflow.com/a/9229821/1757964
*/
function removeDuplicates( array ) {
var seen = {};
return array.filter( function( item ) {
return seen.hasOwnProperty( item ) ? false : ( seen[ item ] = true );
} );
}

/**
* Capitalize the first letter of a string.
*/
Expand All @@ -212,13 +201,6 @@ function loadReplyLink( $, mw ) {
return mw.config.get( "wgNamespaceIds" )[ nsName.toLowerCase().replace( / /g, "_" ) ];
}

/**
* Canonical-ize a namespace.
*/
function canonicalizeNs( ns ) {
return fmtNs( nsNameToId( ns ) );
}

/**
* This function converts any (index-able) iterable into a list.
*/
Expand Down Expand Up @@ -301,10 +283,6 @@ function loadReplyLink( $, mw ) {
.replace( /<span.*?>(.*?)<\/span>/g, "$1" );
}

function wikitextHeaderEqualsDomHeader( wikitextHeader, domHeader ) {
return wikitextToTextContent( wikitextHeader ) === deArmorFrenchSpaces( domHeader );
}

/**
* Finds and returns the div that is the immediate parent of the
* first talk page header on the page, so that we can read all the
Expand Down Expand Up @@ -1858,9 +1836,7 @@ function loadReplyLink( $, mw ) {
// This loop adds sigIdx entries in the metadata dictionary
var sigIdxEls = iterableToList( mainContent.querySelectorAll(
HEADER_SELECTOR + ",span.reply-link-wrapper a" ) );
var currSigIdx = 0, j, numSigIdxEls, currHeaderEl, currHeaderData;
var headerIdx = 0; // index of the current header
var headerLvl = 0; // level of the current header
var currSigIdx = 0, j, numSigIdxEls, currHeaderEl;
for( j = 0, numSigIdxEls = sigIdxEls.length; j < numSigIdxEls; j++ ) {
var headerTagNameMatch = /^h(\d+)$/.exec(
sigIdxEls[j].tagName.toLowerCase() );
Expand Down