Skip to content

Commit

Permalink
added favicon
Browse files Browse the repository at this point in the history
  • Loading branch information
oblomov-dev committed Sep 28, 2024
1 parent 11fb12e commit 138d908
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/z2ui5_cl_cc_favicon.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
CLASS z2ui5_cl_cc_favicon DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .

PUBLIC SECTION.

CLASS-METHODS get_js
RETURNING
VALUE(result) TYPE string.

PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.



CLASS z2ui5_cl_cc_favicon IMPLEMENTATION.


METHOD get_js.

result = `if (!z2ui5.Favicon) { sap.ui.define("z2ui5/Favicon" , [ "sap/ui/core/Control"], (Control)=>{` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.Favicon", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` favicon: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setFavicon(val) {` && |\n| &&
` this.setProperty("favicon", val);` && |\n| &&
` let headTitle = document.querySelector('head');` && |\n| &&
` let setFavicon = document.createElement('link');` && |\n| &&
` setFavicon.setAttribute('rel','shortcut icon');` && |\n| &&
` setFavicon.setAttribute('href',val);` && |\n| &&
` headTitle.appendChild(setFavicon);` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) {}` && |\n| &&
` });` && |\n| &&
` }); }`.

ENDMETHOD.
ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_cc_favicon.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CC_FAVICON</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>cc - document.favicon</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit 138d908

Please sign in to comment.