Skip to content
Merged
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
31 changes: 20 additions & 11 deletions extras/popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,16 @@ span.new-feature-tag.beta {

.option-selection {
text-align: right;
width: 100%;
width: calc(100% - 1rem);
display: flex;
overflow-wrap: break-word;
flex-wrap: wrap;
border: 1.5px solid var(--feature-input-bg);
border-radius: .25rem;
overflow: hidden;
}

.option-selection span {
border: 1.5px solid var(--feature-input-bg);
padding: .25rem;
padding-left: .5rem;
padding-right: .5rem;
Expand All @@ -483,20 +488,24 @@ span.new-feature-tag.beta {
background-color: transparent;
color: var(--secondary-color);
transition: background-color .3s, border .3s, color .3s;
display: inline-block;
word-break: break-word;
white-space: nowrap;
flex: 1 0 auto;
text-align: center;
border-inline-end: 1.5px solid var(--feature-input-bg);
}

.option label {
margin-right: 1rem;
}

.option-selection span.option-selected {
background-color: var(--theme);
color: white;
border: 1.5px solid var(--theme);
}

.option-selection span:first-child {
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem;
border-inline-end: 1.5px solid transparent;
}

.option-selection span:last-child {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem;
}
border-inline-end: none;
}
29 changes: 19 additions & 10 deletions extras/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,16 @@ body {

.option-selection {
text-align: right;
width: 100%;
width: calc(100% - 1rem);
display: flex;
overflow-wrap: break-word;
flex-wrap: wrap;
border: 1.5px solid var(--feature-input-bg);
border-radius: .25rem;
overflow: hidden;
}

.option-selection span {
border: 1.5px solid var(--feature-input-bg);
padding: .25rem;
padding-left: .5rem;
padding-right: .5rem;
Expand All @@ -862,20 +867,24 @@ body {
background-color: transparent;
color: var(--secondary-color);
transition: background-color .3s, border .3s, color .3s;
display: inline-block;
word-break: break-word;
white-space: nowrap;
flex: 1 0 auto;
text-align: center;
border-inline-end: 1.5px solid var(--feature-input-bg);
}

.option label {
margin-right: 1rem;
}

.option-selection span.option-selected {
background-color: var(--theme);
color: white;
border: 1.5px solid var(--theme);
}

.option-selection span:first-child {
border-top-left-radius: .25rem;
border-bottom-left-radius: .25rem;
border-inline-end: 1.5px solid transparent;
}

.option-selection span:last-child {
border-top-right-radius: .25rem;
border-bottom-right-radius: .25rem;
border-inline-end: none;
}
65 changes: 65 additions & 0 deletions features/custom-explore/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"title": "Custom Explore Redirect",
"description": "Automatically redirect to a specific tab on the Explore page.",
"credits": [
{
"username": "ItsThatKittyDragon",
"url": "https://scratch.mit.edu/users/ItsThatKittyDragon/"
},
{
"username": "MaterArc",
"url": "https://scratch.mit.edu/users/MaterArc/"
},
{
"username": "rgantzos",
"url": "https://scratch.mit.edu/users/rgantzos/"
}
],
"type": [
"Website"
],
"tags": [
"New",
"Featured"
],
"scripts": [
{
"file": "script.js",
"runOn": "/*"
}
],
"dynamic": true,
"options": [
{
"id": "custom-explore-tab",
"name": "Tab",
"type": 4,
"options": [
{
"name": "Animations",
"value": "animations"
},
{
"name": "Art",
"value": "art"
},
{
"name": "Games",
"value": "games"
},
{
"name": "Music",
"value": "music"
},
{
"name": "Stories",
"value": "stories"
},
{
"name": "Tutorials",
"value": "tutorials"
}
]
}
]
}
24 changes: 24 additions & 0 deletions features/custom-explore/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default async function({ feature, console }) {
let ELEMENTS = []
let type = feature.settings.get("custom-explore-tab") || "Animations"

ScratchTools.waitForElements("a[href='/explore/projects/'], a[href='/explore/projects'], a[href='/explore/projects/all'], a[href='/explore/projects/all/']", function(a) {
if (a.parentElement.className.includes("sub-nav categories")) return;
ELEMENTS.push(a)

a.href = feature.self.enabled ? `/explore/projects/${type.toLowerCase()}/` : "/explore/projects/"
})

function updateRedirects() {
for (var i in ELEMENTS) {
ELEMENTS[i].href = feature.self.enabled ? `/explore/projects/${type.toLowerCase()}/` : "/explore/projects/"
}
}

feature.addEventListener("disabled", updateRedirects)
feature.addEventListener("enabled", updateRedirects)
feature.settings.addEventListener("changed", function({ value }) {
type = value
updateRedirects()
})
}
5 changes: 5 additions & 0 deletions features/features.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[
{
"version": 2,
"id": "custom-explore",
"versionAdded": "v4.0.0"
},
{
"version": 2,
"id": "stage-in-spritepane",
Expand Down