mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-03 06:09:19 +00:00
Merge branch 'dev' into boosts
This commit is contained in:
@@ -23,6 +23,9 @@ mkdir windsign-temp -ErrorAction SilentlyContinue
|
||||
# echo "Downloaded git objects repo to"
|
||||
#} -Verbose -ArgumentList $PWD -Debug
|
||||
|
||||
$env:SURFER_MOZCONFIG_ONLY="1"
|
||||
$env:SURFER_SIGNING_MODE=""
|
||||
|
||||
Start-Job -Name "DownloadGitl10n" -ScriptBlock {
|
||||
param($PWD)
|
||||
cd $PWD
|
||||
@@ -31,14 +34,11 @@ Start-Job -Name "DownloadGitl10n" -ScriptBlock {
|
||||
echo "Fetched l10n and Firefox's one"
|
||||
} -Verbose -ArgumentList $PWD -Debug
|
||||
|
||||
Start-Job -Name "SurferInit" -ScriptBlock {
|
||||
param($PWD)
|
||||
cd $PWD
|
||||
npm run import -- --verbose
|
||||
$surferJson = Get-Content surfer.json | ConvertFrom-Json
|
||||
$version = $surferJson.brands.release.release.displayVersion
|
||||
npm run ci -- $version
|
||||
} -Verbose -ArgumentList $PWD -Debug
|
||||
$surferJson = Get-Content surfer.json | ConvertFrom-Json
|
||||
$version = $surferJson.brands.release.release.displayVersion
|
||||
npm run ci -- $version
|
||||
npm run import -- --verbose
|
||||
npm run build
|
||||
|
||||
echo "Downloading artifacts info"
|
||||
$artifactsInfo=gh api repos/zen-browser/desktop/actions/runs/$GithubRunId/artifacts
|
||||
@@ -120,7 +120,6 @@ signtool.exe sign /n "$SignIdentity" /t http://time.certum.pl/ /fd sha256 /v $fi
|
||||
$env:ZEN_RELEASE="true"
|
||||
$env:SURFER_SIGNING_MODE="true"
|
||||
$env:SCCACHE_GHA_ENABLED="false"
|
||||
Wait-Job -Name "SurferInit"
|
||||
Wait-Job -Name "DownloadGitl10n"
|
||||
|
||||
function SignAndPackage($name) {
|
||||
|
||||
@@ -47,6 +47,7 @@ pictureinpicture-minimize-btn =
|
||||
zen-panel-ui-gradient-generator-custom-color = Custom Color
|
||||
|
||||
zen-copy-current-url-confirmation = Copied current URL!
|
||||
zen-copy-current-url-as-markdown-confirmation = Copied current URL as Markdown!
|
||||
|
||||
zen-general-cancel-label =
|
||||
.label = Cancel
|
||||
|
||||
@@ -91,6 +91,9 @@ zen-live-folder-github-option-repo =
|
||||
zen-live-folder-github-pull-requests =
|
||||
.label = Pull Requests
|
||||
|
||||
zen-live-folder-github-issues =
|
||||
.label = Issues
|
||||
|
||||
zen-live-folder-github-option-repo-list-note =
|
||||
.label = This list is generated based on your currently active pull requests.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/base/content/navigator-toolbox.js b/browser/base/content/navigator-toolbox.js
|
||||
index 15469e9d9b91c1eaef2578c9e43b6999edac3392..553402b41bc15f7cd99bf87c54416dc66d7c03e7 100644
|
||||
index 15469e9d9b91c1eaef2578c9e43b6999edac3392..95ae5036b57baeb5237603c0921f1e9252af6919 100644
|
||||
--- a/browser/base/content/navigator-toolbox.js
|
||||
+++ b/browser/base/content/navigator-toolbox.js
|
||||
@@ -6,7 +6,7 @@
|
||||
@@ -19,15 +19,25 @@ index 15469e9d9b91c1eaef2578c9e43b6999edac3392..553402b41bc15f7cd99bf87c54416dc6
|
||||
#picture-in-picture-button,
|
||||
#urlbar-zoom-button,
|
||||
#star-button-box,
|
||||
@@ -206,6 +207,7 @@ document.addEventListener(
|
||||
case "vertical-tabs-newtab-button":
|
||||
case "tabs-newtab-button":
|
||||
case "new-tab-button":
|
||||
+ case "zen-tabs-wrapper":
|
||||
@@ -209,6 +210,17 @@ document.addEventListener(
|
||||
gBrowser.handleNewTabMiddleClick(element, event);
|
||||
break;
|
||||
|
||||
@@ -318,6 +320,7 @@ document.addEventListener(
|
||||
+ case "zen-tabs-wrapper":
|
||||
+ if (event.button == 1) {
|
||||
+ BrowserCommands.openTab();
|
||||
+ // Stop the propagation of the click event, to prevent the event from being
|
||||
+ // handled more than once.
|
||||
+ // E.g. see https://bugzilla.mozilla.org/show_bug.cgi?id=1657992#c4
|
||||
+ event.stopPropagation();
|
||||
+ event.preventDefault();
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
case "back-button":
|
||||
case "forward-button":
|
||||
case "reload-button":
|
||||
@@ -318,6 +330,7 @@ document.addEventListener(
|
||||
#downloads-button,
|
||||
#fxa-toolbar-menu-button,
|
||||
#unified-extensions-button,
|
||||
@@ -35,7 +45,7 @@ index 15469e9d9b91c1eaef2578c9e43b6999edac3392..553402b41bc15f7cd99bf87c54416dc6
|
||||
#library-button,
|
||||
#split-view-button
|
||||
`);
|
||||
@@ -401,6 +404,16 @@ document.addEventListener(
|
||||
@@ -401,6 +414,16 @@ document.addEventListener(
|
||||
gUnifiedExtensions.togglePanel(event);
|
||||
break;
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
data-l10n-id="zen-live-folder-github-pull-requests"
|
||||
command="cmd_zenNewLiveFolder"
|
||||
image="chrome://browser/skin/zen-icons/selectable/logo-github.svg" />
|
||||
<menuitem
|
||||
data-l10n-id="zen-live-folder-github-issues"
|
||||
command="cmd_zenNewLiveFolder"
|
||||
image="chrome://browser/skin/zen-icons/selectable/logo-github.svg" />
|
||||
<menuitem
|
||||
data-l10n-id="zen-live-folder-type-rss"
|
||||
command="cmd_zenNewLiveFolder"
|
||||
|
||||
@@ -1,7 +1,31 @@
|
||||
diff --git a/browser/base/content/main-popupset.inc.xhtml b/browser/base/content/main-popupset.inc.xhtml
|
||||
--- a/browser/base/content/main-popupset.inc.xhtml
|
||||
+++ b/browser/base/content/main-popupset.inc.xhtml
|
||||
@@ -556,10 +556,11 @@
|
||||
@@ -193,10 +193,11 @@
|
||||
<!-- Starting point for selection actions -->
|
||||
<panel class="panel-no-padding"
|
||||
id="selection-shortcut-action-panel"
|
||||
noautofocus="true"
|
||||
consumeoutsideclicks="never"
|
||||
+ nonnativepopover="true"
|
||||
type="arrow">
|
||||
<hbox class="panel-subview-body">
|
||||
<html:moz-button id="ai-action-button"/>
|
||||
</hbox>
|
||||
</panel>
|
||||
@@ -204,10 +205,11 @@
|
||||
|
||||
<!-- Shortcut options for Gen AI action -->
|
||||
<panel class="panel-no-padding"
|
||||
id="chat-shortcuts-options-panel"
|
||||
noautofocus="true"
|
||||
+ nonnativepopover="true"
|
||||
type="arrow">
|
||||
<vbox class="panel-subview-body"/>
|
||||
</panel>
|
||||
|
||||
<html:template id="screenshotsPagePanelTemplate">
|
||||
@@ -556,10 +558,11 @@
|
||||
type="arrow"
|
||||
orient="vertical"
|
||||
noautofocus="true"
|
||||
@@ -43,6 +67,40 @@ diff --git a/browser/components/customizableui/content/panelUI.inc.xhtml b/brows
|
||||
viewCacheId="appMenu-viewCache">
|
||||
</panelmultiview>
|
||||
</panel>
|
||||
diff --git a/dom/xul/XULPopupElement.cpp b/dom/xul/XULPopupElement.cpp
|
||||
--- a/dom/xul/XULPopupElement.cpp
|
||||
+++ b/dom/xul/XULPopupElement.cpp
|
||||
@@ -84,10 +84,15 @@
|
||||
|
||||
void XULPopupElement::OpenPopupAtScreen(int32_t aXPos, int32_t aYPos,
|
||||
bool aIsContextMenu,
|
||||
Event* aTriggerEvent) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
+ // TODO(cheff): We do the same at nsCocoaWindow::Show but it doesn't seem
|
||||
+ // to trigger a restyle so `appearance: auto` doesn't apply the native
|
||||
+ // popover style. We should remove this and use the other implementation
|
||||
+ // because this is a bit of a hack, not sure how reliable it is.
|
||||
+ SetXULBoolAttr(nsGkAtoms::nonnativepopover, true, IgnoreErrors());
|
||||
if (pm) {
|
||||
pm->ShowPopupAtScreen(this, aXPos, aYPos, aIsContextMenu, aTriggerEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,10 +101,14 @@
|
||||
int32_t aWidth, int32_t aHeight,
|
||||
bool aIsContextMenu,
|
||||
bool aAttributesOverride,
|
||||
Event* aTriggerEvent) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
+ // TODO: See OpenPopupAtScreen. We should remove this and use the other
|
||||
+ // implementation because this is a bit of a hacky way to determine whether to
|
||||
+ // use a native popover or not.
|
||||
+ SetXULBoolAttr(nsGkAtoms::nonnativepopover, true, IgnoreErrors());
|
||||
if (pm) {
|
||||
pm->ShowPopupAtScreenRect(
|
||||
this, aPosition, nsIntRect(aXPos, aYPos, aWidth, aHeight),
|
||||
aIsContextMenu, aAttributesOverride, aTriggerEvent);
|
||||
}
|
||||
diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h
|
||||
--- a/layout/xul/nsMenuPopupFrame.h
|
||||
+++ b/layout/xul/nsMenuPopupFrame.h
|
||||
@@ -118,7 +176,7 @@ diff --git a/toolkit/themes/shared/global-shared.css b/toolkit/themes/shared/glo
|
||||
|
||||
+/* stylelint-disable-next-line media-query-no-invalid */
|
||||
+@media -moz-pref("widget.macos.native-popovers") and (-moz-platform: macos) {
|
||||
+ panel:where([nativepopover="true"]) {
|
||||
+ panel:not(:where([nonnativepopover="true"])) {
|
||||
+ background-color: transparent;
|
||||
+ --panel-background: transparent;
|
||||
+ --panel-shadow: none;
|
||||
@@ -176,7 +234,7 @@ diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h
|
||||
@interface BorderlessWindow : BaseWindow {
|
||||
}
|
||||
|
||||
@@ -201,10 +216,13 @@
|
||||
@@ -201,10 +216,14 @@
|
||||
typedef nsIWidget Inherited;
|
||||
|
||||
public:
|
||||
@@ -184,6 +242,7 @@ diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h
|
||||
|
||||
+ // Check if this window should use NSPopover for popup/menu display
|
||||
+ bool ShouldUseNSPopover() const;
|
||||
+ bool ShouldShowAsNSPopover() const override;
|
||||
+
|
||||
[[nodiscard]] nsresult Create(nsIWidget* aParent, const DesktopIntRect& aRect,
|
||||
const InitData&) override;
|
||||
@@ -281,22 +340,33 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||
|
||||
if (!mWindow) {
|
||||
@@ -5227,10 +5282,65 @@
|
||||
@@ -5185,10 +5240,17 @@
|
||||
}
|
||||
|
||||
NSWindow* nativeParentWindow =
|
||||
mParent ? (NSWindow*)mParent->GetNativeData(NS_NATIVE_WINDOW) : nil;
|
||||
|
||||
+ bool shouldUseNativePopover = false;
|
||||
+ if (mWindowType == WindowType::Popup && aState) {
|
||||
+ nsMenuPopupFrame* popupFrame = GetPopupFrame();
|
||||
+ popupFrame->PopupElement().SetXULBoolAttr(
|
||||
+ nsGkAtoms::nonnativepopover, !ShouldShowAsNSPopover(), IgnoreErrors());
|
||||
+ }
|
||||
+
|
||||
if (aState && !mBounds.IsEmpty()) {
|
||||
// If we had set the activationPolicy to accessory, then right now we won't
|
||||
// have a dock icon. Make sure that we undo that and show a dock icon now
|
||||
// that we're going to show a window.
|
||||
if (NSApp.activationPolicy != NSApplicationActivationPolicyRegular) {
|
||||
@@ -5227,10 +5289,54 @@
|
||||
mWindow.contentView.needsDisplay = YES;
|
||||
if (!nativeParentWindow || mPopupLevel != PopupLevel::Parent) {
|
||||
[mWindow orderFront:nil];
|
||||
}
|
||||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||
+ nsMenuPopupFrame* popupFrame = GetPopupFrame();
|
||||
+ mozilla::ErrorResult rv;
|
||||
+ if ([mWindow isKindOfClass:[PopupWindow class]] &&
|
||||
+ [(PopupWindow*)mWindow usePopover] && popupFrame &&
|
||||
+ popupFrame->ShouldFollowAnchor() &&
|
||||
+ !popupFrame->PopupElement().GetBoolAttr(
|
||||
+ nsGkAtoms::nonnativepopover)) {
|
||||
+ if (ShouldShowAsNSPopover()) {
|
||||
+ nsMenuPopupFrame* popupFrame = GetPopupFrame();
|
||||
+ if (nativeParentWindow) {
|
||||
+ popupFrame->PopupElement().SetXULBoolAttr(nsGkAtoms::nativepopover,
|
||||
+ true, rv);
|
||||
+ NSRectEdge preferredEdge =
|
||||
+ AlignmentPositionToNSRectEdge(popupFrame->GetAlignmentPosition());
|
||||
+ nsRect anchorRectAppUnits = popupFrame->GetUntransformedAnchorRect();
|
||||
@@ -337,17 +407,13 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
+ SyncPopoverBounds([(PopupWindow*)mWindow popover], popupFrame);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ if (popupFrame) {
|
||||
+ popupFrame->PopupElement().SetXULBoolAttr(nsGkAtoms::nativepopover,
|
||||
+ false, rv);
|
||||
+ }
|
||||
// If our popup window is a non-native context menu, tell the OS (and
|
||||
// other programs) that a menu has opened. This is how the OS knows to
|
||||
// close other programs' context menus when ours open.
|
||||
if ([mWindow isKindOfClass:[PopupWindow class]] &&
|
||||
[(PopupWindow*)mWindow isContextMenu]) {
|
||||
@@ -5301,10 +5411,15 @@
|
||||
@@ -5301,10 +5407,15 @@
|
||||
// of a window it hides the parent window.
|
||||
if (mWindowType == WindowType::Popup && nativeParentWindow) {
|
||||
[nativeParentWindow removeChildWindow:mWindow];
|
||||
@@ -363,7 +429,7 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
// other programs) that a menu has closed.
|
||||
if ([mWindow isKindOfClass:[PopupWindow class]] &&
|
||||
[(PopupWindow*)mWindow isContextMenu]) {
|
||||
@@ -5351,10 +5466,17 @@
|
||||
@@ -5351,10 +5462,28 @@
|
||||
return false;
|
||||
}
|
||||
return nsIWidget::ShouldUseOffMainThreadCompositing();
|
||||
@@ -372,8 +438,19 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
+bool nsCocoaWindow::ShouldUseNSPopover() const {
|
||||
+ // Use NSPopover for panel popups when the preference is enabled
|
||||
+ // But not for detached popups - they should use traditional window logic
|
||||
+ return mWindowType == WindowType::Popup && mPopupType == PopupType::Panel &&
|
||||
+ mozilla::StaticPrefs::widget_macos_native_popovers();
|
||||
+ return (mWindowType == WindowType::Popup && mPopupType == PopupType::Panel &&
|
||||
+ mozilla::StaticPrefs::widget_macos_native_popovers());
|
||||
+}
|
||||
+
|
||||
+bool nsCocoaWindow::ShouldShowAsNSPopover() const {
|
||||
+ if (!ShouldUseNSPopover()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ nsMenuPopupFrame* popupFrame = GetPopupFrame();
|
||||
+ return [mWindow isKindOfClass:[PopupWindow class]] &&
|
||||
+ [(PopupWindow*)mWindow usePopover] && popupFrame &&
|
||||
+ popupFrame->ShouldFollowAnchor() &&
|
||||
+ !popupFrame->PopupElement().GetBoolAttr(nsGkAtoms::nonnativepopover);
|
||||
+}
|
||||
+
|
||||
TransparencyMode nsCocoaWindow::GetTransparencyMode() {
|
||||
@@ -381,7 +458,7 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
|
||||
return mWindow.isOpaque ? TransparencyMode::Opaque
|
||||
: TransparencyMode::Transparent;
|
||||
@@ -6313,10 +6435,20 @@
|
||||
@@ -6313,10 +6442,20 @@
|
||||
// We ignore aRepaint -- we have to call display:YES, otherwise the
|
||||
// title bar doesn't immediately get repainted and is displayed in
|
||||
// the wrong place, leading to a visual jump.
|
||||
@@ -402,7 +479,7 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
|
||||
void nsCocoaWindow::Resize(const DesktopRect& aRect, bool aRepaint) {
|
||||
DoResize(aRect.x, aRect.y, aRect.width, aRect.height, aRepaint, false);
|
||||
@@ -8277,18 +8409,27 @@
|
||||
@@ -8277,18 +8416,27 @@
|
||||
backing:(NSBackingStoreType)bufferingType
|
||||
defer:(BOOL)deferCreation {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
@@ -430,7 +507,7 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
// Return 0 in order to match what the system does for sheet windows and
|
||||
// _NSPopoverWindows.
|
||||
- (CGFloat)_backdropBleedAmount {
|
||||
@@ -8342,10 +8483,120 @@
|
||||
@@ -8342,10 +8490,120 @@
|
||||
|
||||
- (void)setIsContextMenu:(BOOL)flag {
|
||||
mIsContextMenu = flag;
|
||||
@@ -551,6 +628,25 @@ diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
|
||||
return NO;
|
||||
}
|
||||
|
||||
diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h
|
||||
--- a/widget/nsIWidget.h
|
||||
+++ b/widget/nsIWidget.h
|
||||
@@ -836,10 +836,15 @@
|
||||
virtual void SuppressAnimation(bool aSuppress) {}
|
||||
|
||||
/** Sets windows-specific mica backdrop on this widget. */
|
||||
virtual void SetMicaBackdrop(bool) {}
|
||||
|
||||
+ /**
|
||||
+ * Determine whether this widget should be shown as an NSPopover.
|
||||
+ */
|
||||
+ virtual bool ShouldShowAsNSPopover() const { return false; }
|
||||
+
|
||||
/**
|
||||
* Return size mode (minimized, maximized, normalized).
|
||||
* Returns a value from nsSizeMode (see nsIWidgetListener.h)
|
||||
*/
|
||||
virtual nsSizeMode SizeMode() = 0;
|
||||
diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py
|
||||
--- a/xpcom/ds/StaticAtoms.py
|
||||
+++ b/xpcom/ds/StaticAtoms.py
|
||||
@@ -566,14 +662,13 @@ diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py
|
||||
Atom("highest", "highest"),
|
||||
Atom("horizontal", "horizontal"),
|
||||
Atom("hover", "hover"),
|
||||
@@ -756,10 +757,12 @@
|
||||
@@ -756,10 +757,11 @@
|
||||
Atom("nohref", "nohref"),
|
||||
Atom("noinitialselection", "noinitialselection"),
|
||||
Atom("nomodule", "nomodule"),
|
||||
Atom("nonce", "nonce"),
|
||||
Atom("none", "none"),
|
||||
+ Atom("nonnativepopover", "nonnativepopover"),
|
||||
+ Atom("nativepopover", "nativepopover"),
|
||||
Atom("noresize", "noresize"),
|
||||
Atom("normal", "normal"),
|
||||
Atom("normalizeSpace", "normalize-space"),
|
||||
|
||||
@@ -115,7 +115,7 @@ window.gZenCommonActions = {
|
||||
const tabTitle = gBrowser.selectedTab.label;
|
||||
const markdownLink = `[${tabTitle}](${currentUrl.displaySpec})`;
|
||||
ClipboardHelper.copyString(markdownLink);
|
||||
gZenUIManager.showToast("zen-copy-current-url-confirmation", { timeout: 3000 });
|
||||
gZenUIManager.showToast("zen-copy-current-url-as-markdown-confirmation", { timeout: 3000 });
|
||||
},
|
||||
|
||||
throttle(f, delay) {
|
||||
|
||||
@@ -30,7 +30,7 @@ panel[type="arrow"]:not(#feature-callout) {
|
||||
}
|
||||
|
||||
@media (-moz-platform: macos) {
|
||||
&:where(:not([nativepopover="true"])) {
|
||||
&:where([nonnativepopover="true"], :not([type="arrow"])) {
|
||||
appearance: auto !important;
|
||||
-moz-default-appearance: menupopup;
|
||||
/* We set the default background here, rather than on ::part(content),
|
||||
|
||||
@@ -123,6 +123,8 @@ export class nsZenLiveFolderProvider {
|
||||
|
||||
fetch(url, { maxContentLength = 5 * 1024 * 1024 } = {}) {
|
||||
const uri = lazy.NetUtil.newURI(url);
|
||||
// TODO: Support userContextId when fetching, it should be inherited from the folder's
|
||||
// current space context ID.
|
||||
let userContextId = 0;
|
||||
let folder = this.manager.getFolderForLiveFolder(this);
|
||||
if (folder) {
|
||||
|
||||
@@ -98,6 +98,10 @@ class nsZenLiveFoldersManager {
|
||||
this.createFolder("github:pull-requests");
|
||||
break;
|
||||
}
|
||||
case "zen-live-folder-github-issues": {
|
||||
this.createFolder("github:issues");
|
||||
break;
|
||||
}
|
||||
case "zen-live-folder-type-rss": {
|
||||
this.createFolder("rss");
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,9 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
constructor({ id, state, manager }) {
|
||||
super({ id, state, manager });
|
||||
|
||||
this.state.url = "https://github.com/pulls/assigned";
|
||||
this.state.url = "https://github.com/issues/assigned";
|
||||
this.state.type = state.type;
|
||||
|
||||
this.state.options = state.options ?? {};
|
||||
this.state.repos = new Set(state.repos ?? []);
|
||||
this.state.options.repoExcludes = new Set(state.options.repoExcludes ?? []);
|
||||
@@ -38,34 +40,37 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
}
|
||||
|
||||
const document = new DOMParser().parseFromString(text, "text/html");
|
||||
const pull_requests = document.querySelectorAll("div[class^=Description-module__container]");
|
||||
const issues = document.querySelectorAll(
|
||||
"div[class^=IssueItem-module__defaultRepoContainer]"
|
||||
);
|
||||
const items = [];
|
||||
const activeRepos = new Set();
|
||||
|
||||
if (pull_requests.length) {
|
||||
const authors = document.querySelectorAll(
|
||||
"div[class^=MainContent-module__inner] [data-testid='timestamp-container'] span:nth-child(2)"
|
||||
);
|
||||
if (issues.length) {
|
||||
const authors = document.querySelectorAll("a[class^=IssueItem-module__authorCreatedLink]");
|
||||
const titles = document.querySelectorAll("div[class^=Title-module__container]");
|
||||
const links = document.querySelectorAll("a[class^=Title-module__anchor]");
|
||||
const links = document.querySelectorAll('[data-testid="issue-pr-title-link"]');
|
||||
|
||||
for (let i = 0; i < pull_requests.length; i++) {
|
||||
const repo = pull_requests[i].childNodes[0].textContent;
|
||||
const prNum = pull_requests[i].childNodes[4].textContent;
|
||||
const author = authors[i]?.firstChild?.textContent;
|
||||
for (let i = 0; i < issues.length; i++) {
|
||||
const [rawRepo, rawNumber] = issues[i].childNodes;
|
||||
const author = authors[i]?.textContent;
|
||||
const title = titles[i]?.textContent;
|
||||
const prUrl = links[i]?.href;
|
||||
const issueUrl = links[i]?.href;
|
||||
|
||||
const repo = rawRepo.textContent?.trim();
|
||||
if (repo) {
|
||||
activeRepos.add(repo);
|
||||
}
|
||||
|
||||
const numberMatch = rawNumber?.textContent?.match(/[0-9]+/);
|
||||
const number = numberMatch?.[0] ?? "";
|
||||
|
||||
items.push({
|
||||
title,
|
||||
subtitle: author,
|
||||
icon: "chrome://browser/content/zen-images/favicons/github.svg",
|
||||
url: new URL(prUrl, this.state.url).href,
|
||||
id: `${repo}#${prNum}`,
|
||||
url: "https://github.com" + issueUrl,
|
||||
id: `${repo}#${number}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -83,7 +88,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
let searchParams = new URLSearchParams();
|
||||
const options = [
|
||||
{
|
||||
value: "is:open",
|
||||
value: "state:open",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
@@ -93,7 +98,11 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
[
|
||||
{
|
||||
value: "is:pr",
|
||||
enabled: true,
|
||||
enabled: this.state.type === "pull-requests",
|
||||
},
|
||||
{
|
||||
value: "is:issue",
|
||||
enabled: this.state.type === "issues",
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -134,7 +143,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
}
|
||||
}
|
||||
|
||||
searchParams.set("q", outputString);
|
||||
searchParams.set("q", outputString.trim().replace(/ +(?= )/g, ""));
|
||||
return searchParams.toString();
|
||||
}
|
||||
|
||||
@@ -177,6 +186,7 @@ export class nsGithubLiveFolderProvider extends nsZenLiveFolderProvider {
|
||||
l10nId: "zen-live-folder-github-option-review-requested",
|
||||
key: "reviewRequested",
|
||||
checked: this.state.options.reviewRequested ?? false,
|
||||
hidden: this.state.type === "issues",
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
|
||||
@@ -1137,7 +1137,8 @@
|
||||
position: absolute;
|
||||
|
||||
:root[zen-single-toolbar="true"] &:not(:empty) {
|
||||
padding-top: 4px;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
&[hidden="true"] {
|
||||
|
||||
Reference in New Issue
Block a user