From 6a897c0249fd468d720b8375a35d466449570cef Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Sat, 9 Nov 2019 00:50:27 +0800 Subject: [PATCH] fix: update DOM structure --- src/utils/DOMHelper.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utils/DOMHelper.ts b/src/utils/DOMHelper.ts index 31d681a..3b76393 100644 --- a/src/utils/DOMHelper.ts +++ b/src/utils/DOMHelper.ts @@ -154,7 +154,7 @@ const PAGE_TYPES = { * TODO: distinguish type 'preview' */ function getCurrentPageType() { - const blobWrapperSelector = '.repository-content .file .blob-wrapper table' + const blobWrapperSelector = '.repository-content .blob-wrapper table' const readmeSelector = '.repository-content .readme' return ( $(blobWrapperSelector, () => PAGE_TYPES.RAW_TEXT) || @@ -188,7 +188,7 @@ function attachCopyFileBtn() { */ function getCodeElement() { if (getCurrentPageType() === PAGE_TYPES.RAW_TEXT) { - const codeContentSelector = '.repository-content .file .data table' + const codeContentSelector = '.repository-content .data table' const codeContentElement = $(codeContentSelector) if (!codeContentElement) { raiseError(new Error('cannot find code content element')) @@ -209,10 +209,8 @@ function attachCopyFileBtn() { if (getCurrentPageType() === PAGE_TYPES.RAW_TEXT) { const btnGroupSelector = [ - // the button group next to navigation bar - '.repository-content .file-navigation.js-zeroclipboard-container .BtnGroup', // the button group in file content header - '.repository-content .file .file-header .file-actions .BtnGroup', + '.repository-content > .Box > .Box-header .BtnGroup', ].join(', ') const btnGroups = document.querySelectorAll(btnGroupSelector)