webfast 0.1.85 → 0.1.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/app/content/js/webfast.js +62 -9
- package/package.json +1 -1
package/README.md
CHANGED
@@ -130,6 +130,19 @@ program.modules.dependOn({REQUIRE},program,`{UNIQUE_NAME}-sync`,function(){
|
|
130
130
|
console.log(`Depend On CallBack`);
|
131
131
|
});
|
132
132
|
```
|
133
|
+
## NEW BETA FEATURE
|
134
|
+
Feature where youo can add a special frame for multiple views through telegram without reloading
|
135
|
+
````
|
136
|
+
await web.fast.telegram(`frame`).set(id,`https://${window.location.hostname}/concepts/esimco/package#${id}`,async function(id){
|
137
|
+
console.log(`Clicked Close`,id);
|
138
|
+
const frame = jQuery(`[wbfst-frame="${id}"]`);
|
139
|
+
console.log(`The Frame`,frame);
|
140
|
+
jQuery(frame).animate({ opacity:0 }, 600,function(){
|
141
|
+
jQuery(this).remove();
|
142
|
+
});
|
143
|
+
|
144
|
+
});
|
145
|
+
````
|
133
146
|
|
134
147
|
## License
|
135
148
|
|
@@ -99,15 +99,68 @@ web.fast = {
|
|
99
99
|
}
|
100
100
|
},
|
101
101
|
telegram : function(action){
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
102
|
+
// check if action is to set frame
|
103
|
+
if (action == `frame`) {
|
104
|
+
return {
|
105
|
+
get : async function(id) {
|
106
|
+
console.log(`Get Frame for ID`,id);
|
107
|
+
},
|
108
|
+
close : async function(id) {
|
109
|
+
console.log(`Close Frame`);
|
110
|
+
},
|
111
|
+
set : async function(id,url,closeAction,zIndex = 9990) {
|
112
|
+
if (web.fast.user != undefined) {
|
113
|
+
//console.error(`NO USER`);
|
114
|
+
//return window.location.href = url;
|
115
|
+
window.Telegram.WebApp.HapticFeedback.impactOccurred('medium');
|
116
|
+
}
|
117
|
+
console.log(`Telegram Frame Set`,id,url,closeAction);
|
118
|
+
let iframe = document.createElement('iframe');
|
119
|
+
iframe.src = url; // Replace with your desired URL
|
120
|
+
|
121
|
+
const settedID = ``+id;
|
122
|
+
// Set additional attributes (optional)
|
123
|
+
iframe.style.border = 'none'; // Remove the border
|
124
|
+
iframe.style.width = '100vw'; // Set width to 100vw
|
125
|
+
iframe.style.height = '100vh'; // Set height to 100vh
|
126
|
+
iframe.style.top = '0'; // Set height to 100vh
|
127
|
+
iframe.style.left = '0'; // Set height to 100vh
|
128
|
+
iframe.style[`z-index`] = zIndex; // Set height to 100vh
|
129
|
+
iframe.id = settedID;
|
130
|
+
|
131
|
+
iframe.style.position = 'fixed';
|
132
|
+
|
133
|
+
// Append the iframe to the body
|
134
|
+
document.body.appendChild(iframe);
|
135
|
+
jQuery(iframe).attr(`id`,settedID);
|
136
|
+
jQuery(iframe).attr(`wbfst-frame`,settedID);
|
137
|
+
|
138
|
+
try {
|
139
|
+
//window.Telegram.WebApp.web_app_open_link(url);
|
140
|
+
if (web.fast.user != undefined) {
|
141
|
+
window.closeIframe = function() {
|
142
|
+
console.log(`Close Iframe`,id);
|
143
|
+
//jQuery(`#${id}`).hide();
|
144
|
+
closeAction(id);
|
145
|
+
}
|
146
|
+
} else {
|
147
|
+
// Set on click event
|
148
|
+
if (closeAction != undefined) {
|
149
|
+
console.log(`Set Close Action`);
|
150
|
+
window.closeIframe = function() {
|
151
|
+
console.log(`Close Iframe`,id);
|
152
|
+
//jQuery(`#${id}`).hide();
|
153
|
+
closeAction(id);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
} catch (err) {
|
159
|
+
console.error(err);
|
160
|
+
console.error(`Error opening link`,url);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
111
164
|
}
|
112
165
|
}
|
113
166
|
}
|