Skip to content

Commit

Permalink
Update functions.js createIconButton extended
Browse files Browse the repository at this point in the history
can create a icon buttons now
  • Loading branch information
raszpl authored Jun 23, 2024
1 parent da707ca commit bbf3083
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ ImprovedTube.setCookie = function (name, value) {
};

ImprovedTube.createIconButton = function (options) {
const button = document.createElement('button'),
const button = options.href ? document.createElement('a') : document.createElement('button'),
svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'),
path = document.createElementNS('http://www.w3.org/2000/svg', 'path'),
type = this.button_icons[options.type];
Expand All @@ -542,6 +542,8 @@ ImprovedTube.createIconButton = function (options) {

if (options.className) button.className = options.className;
if (options.id) button.id = options.id;
if (options.text) button.appendChild(document.createTextNode(options.text));
if (options.href) button.href = options.href;
if (options.onclick) {
if (!options.propagate) {
//we fully own all click events landing on this button
Expand Down

0 comments on commit bbf3083

Please sign in to comment.