-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ab90430
Showing
5 changed files
with
599 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: WordPress Plugin Build Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- "releases/*" | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get latest code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run plugin check | ||
uses: WordPress/plugin-check-action@v1.0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Packages and Dependencies | ||
/node_mudules | ||
/vendor | ||
|
||
# SVN Files | ||
/svn | ||
|
||
# Plugin Zip File | ||
thumbnail-remover.zip |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
jQuery(document).ready(function ($) { | ||
var sectionTemplate = $("#api_sections .api-section").first().clone(); | ||
var sectionCount = $("#api_sections .api-section").length; | ||
|
||
// Add new section | ||
$("#add_section").on("click", function () { | ||
var newSection = sectionTemplate.clone(); | ||
sectionCount++; | ||
|
||
newSection.find("h4").text("Section " + sectionCount); | ||
newSection.find("select, input").each(function () { | ||
var name = $(this).attr("name"); | ||
if (name) { | ||
$(this).attr( | ||
"name", | ||
name.replace("[0]", "[" + (sectionCount - 1) + "]") | ||
); | ||
} | ||
}); | ||
|
||
// Clear the section name field | ||
newSection.find('input[name$="[name]"]').val(sectionCount); | ||
|
||
newSection.attr("data-index", sectionCount - 1); | ||
newSection.find(".remove-section").show(); | ||
|
||
$("#api_sections").append(newSection); | ||
resetRemoveButtons(); | ||
}); | ||
|
||
// Remove section | ||
$("#api_sections").on("click", ".remove-section", function () { | ||
$(this).closest(".api-section").remove(); | ||
resetSectionIndexes(); | ||
resetRemoveButtons(); | ||
}); | ||
|
||
// Reset section indexes | ||
function resetSectionIndexes() { | ||
$("#api_sections .api-section").each(function (index) { | ||
$(this) | ||
.find("h4") | ||
.text("Section " + (index + 1)); | ||
$(this).attr("data-index", index); | ||
$(this) | ||
.find("select, input") | ||
.each(function () { | ||
var name = $(this).attr("name"); | ||
if (name) { | ||
$(this).attr("name", name.replace(/\[\d+\]/, "[" + index + "]")); | ||
} | ||
}); | ||
}); | ||
sectionCount = $("#api_sections .api-section").length; | ||
} | ||
|
||
// Reset remove buttons | ||
function resetRemoveButtons() { | ||
var sections = $("#api_sections .api-section"); | ||
sections.find(".remove-section").show(); | ||
if (sections.length === 1) { | ||
sections.first().find(".remove-section").hide(); | ||
} | ||
} | ||
|
||
// Handle access type switch | ||
$('input[name="custom_api_access_type"]').on("change", function () { | ||
if ($(this).val() === "private") { | ||
$("#custom_api_roles_row").show(); | ||
} else { | ||
$("#custom_api_roles_row").hide(); | ||
} | ||
}); | ||
|
||
// Initialize | ||
resetRemoveButtons(); | ||
}); |
Oops, something went wrong.