Skip to content

Commit

Permalink
Standalone SVG icons
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuletpol committed Dec 3, 2024
1 parent c91a9d0 commit 48430bd
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 6 deletions.
50 changes: 50 additions & 0 deletions repository/ib-filter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
key: ib-filter
name: Sample filter
category: filters
instructions: This is a sample filter.
filter: >
var inlineRegex2 = /\\\(((?:.|\n)+?)\\\)/mgi;
var displayRegex2 = /\\\[((?:.|\n)+?)\\\]/mgi;
var divDisplaynotranslateRegex = /<\s*div\s+class\s*=\s*\"\s*notranslate\s*\"\s*>(\s*\\\[((?:.|\n)+?)\\\]\s*)<\/\s*div\s*>/mgi;
var spanInlinenotranslateRegex = /<\s*span\s+class\s*=\s*\"\s*notranslate\s*\"\s*>(\s*\\\(((?:.|\n)+?)\\\)\s*)<\/\s*span\s*>/mgi;
var verifiedRegex = /<!--filtre notranslate aplicat (.*?)-->/mgi;
var randomkey = function() {
return 'k'+Math.random().toString(32).substring(2);
};
var formulesOk = 0;
var formulesPendents = 0;
var mapaFormulas = {};
var code = text.replace(divDisplaynotranslateRegex, function ($0, $1, $2, $3) {
var key = randomkey() + formulesOk;
mapaFormulas[key] = $0;
formulesOk++;
return " [[["+key+"]]] ";
});
code = code.replace(spanInlinenotranslateRegex, function ($0, $1, $2, $3) {
var key = randomkey() + formulesOk;
mapaFormulas[key] = $0;
formulesOk++;
return " [[["+key+"]]] ";
});
code = code.replace(inlineRegex2, function ($0, $1, $2, $3) {
formulesPendents++;
return "<span class=\"notranslate\"> \\(" + $1 + "\\)</span>";
});
code = code.replace(displayRegex2, function ($0, $1, $2, $3) {
formulesPendents++;
return " <div class=\"notranslate\"> \\[" + $1 + "\\] </div>";
});
var claus = Object.keys(mapaFormulas);
for(var i=0; i<claus.length; i++) {
var key = claus[i];
code = code.replace("[[["+key+"]]]", mapaFormulas[key]);
}
var total = formulesPendents + formulesOk;
var msg_stats = "S'han detectat " + total + " fòrmules i s'han corregit "+formulesPendents;
if(formulesPendents===0){
code=null;
}
return [code, msg_stats];
author: Josep Mulet Pol <pep.mulet@gmail.com>
version: 2024.12.01
25 changes: 24 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,31 @@ h4.tiny_widgethub-headertext {
}
}

/********************************** Specific Widget definitions styles */
/********************************* Icons definitions */
/** Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.**/
.wh-icon {
background-size: 18px;
background-repeat: no-repeat;
background-position: center;
}
.wh-arrow-down {
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M32 64C14.3 64 0 49.7 0 32S14.3 0 32 0l96 0c53 0 96 43 96 96l0 306.7 73.4-73.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-128 128c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 402.7 160 96c0-17.7-14.3-32-32-32L32 64z"/></svg>');
}
.wh-arrow-left {
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"/></svg>');
}
.wh-arrow-ban {
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M367.2 412.5L99.5 144.8C77.1 176.1 64 214.5 64 256c0 106 86 192 192 192c41.5 0 79.9-13.1 111.2-35.5zm45.3-45.3C434.9 335.9 448 297.5 448 256c0-106-86-192-192-192c-41.5 0-79.9 13.1-111.2 35.5L412.5 367.2zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"/></svg>');
}
.wh-arrow-flag {
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M32 0C49.7 0 64 14.3 64 32l0 16 69-17.2c38.1-9.5 78.3-5.1 113.5 12.5c46.3 23.2 100.8 23.2 147.1 0l9.6-4.8C423.8 28.1 448 43.1 448 66.1l0 279.7c0 13.3-8.3 25.3-20.8 30l-34.7 13c-46.2 17.3-97.6 14.6-141.7-7.4c-37.9-19-81.3-23.7-122.5-13.4L64 384l0 96c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-80 0-66L0 64 0 32C0 14.3 14.3 0 32 0zM64 187.1l64-13.9 0 65.5L64 252.6 64 318l48.8-12.2c5.1-1.3 10.1-2.4 15.2-3.3l0-63.9 38.9-8.4c8.3-1.8 16.7-2.5 25.1-2.1l0-64c13.6 .4 27.2 2.6 40.4 6.4l23.6 6.9 0 66.7-41.7-12.3c-7.3-2.1-14.8-3.4-22.3-3.8l0 71.4c21.8 1.9 43.3 6.7 64 14.4l0-69.8 22.7 6.7c13.5 4 27.3 6.4 41.3 7.4l0-64.2c-7.8-.8-15.6-2.3-23.2-4.5l-40.8-12 0-62c-13-3.8-25.8-8.8-38.2-15c-8.2-4.1-16.9-7-25.8-8.8l0 72.4c-13-.4-26 .8-38.7 3.6L128 173.2 128 98 64 114l0 73.1zM320 335.7c16.8 1.5 33.9-.7 50-6.8l14-5.2 0-71.7-7.9 1.8c-18.4 4.3-37.3 5.7-56.1 4.5l0 77.4zm64-149.4l0-70.8c-20.9 6.1-42.4 9.1-64 9.1l0 69.4c13.9 1.4 28 .5 41.7-2.6l22.3-5.2z"/></svg>');
}
.wh-arrow-xmark {
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>');
}


/********************************** Specific Widget definitions styles */
/** subsection **/
h4.wh-subsub {
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion templates/paramsModal.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</div>
{{/body}}
{{$footer}}
<button class="btn btn-secondary"><i class="fa fas fa-arrow-left"></i></button>
<button class="btn btn-secondary"><i class="wh-icon wh-left"></i></button>
<button class="btn btn-primary">{{#str}} accept, tiny_widgethub {{/str}}</button>
{{/footer}}
{{/ core/modal }}
8 changes: 4 additions & 4 deletions templates/pickerModal.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<div class="tiny_widgethub-top input-group">
<input type="text" name="widgethub_search_textfield" class="form-control" placeholder="{{#str}} wsearch, tiny_widgethub {{/str}}" style="width:80%" value="{{searchText}}">
<button id="widget-clearfilter-btn{{rid}}" class="ml-1 btn btn-sm btn-secondary" title="{{#str}} rmfilter, tiny_widgethub {{/str}}">
<i class="fa fas fa-times"></i>
<i class="wh-icon wh-xmark"></i>
</button>
<div class="tiny_widgethub-recent p-2">
{{#recent}}
Expand Down Expand Up @@ -108,15 +108,15 @@
{{#selectable}} data-selectable="true"{{/selectable}}>
{{#isfilter}}
<button class="col-2 btn {{#filterset}}btn-primary{{/filterset}} {{^filterset}}btn-outline-primary{{/filterset}}" data-auto="{{filterset}}" title="Automatic">
<i class="fas fa fa-flag-checkered"></i>
<i class="wh-icon wh-flag"></i>
</button>
{{/isfilter}}
<button title="{{widgettitle}}" data-category="{{category}}"
class="{{#isfilter}}col-8{{/isfilter}} {{^isfilter}}col-10{{/isfilter}} btn btn-outline-primary tiny_widgethub-btn" data-insert="false">
<span>{{#disabled}}<i class="fa fas fa-ban"></i>{{/disabled}} {{widgetname}}</span>
<span>{{#disabled}}<i class="wh-icon wh-ban"></i>{{/disabled}} {{widgetname}}</span>
</button>
<button class="col-2 btn btn-outline-primary" data-insert="true" title="{{#str}} directinsert, tiny_widgethub {{/str}}">
<i class="fa-solid fa-arrow-turn-down"></i>
<i class="wh-icon wh-arrow-down"></i>
</button>

</div>
Expand Down

0 comments on commit 48430bd

Please sign in to comment.