I have the following chrome extension codes and i want to know how to convert it in firefox extension
here are the code files.
manifest.json
{
"name": "iFB invite your friends in Facebook Events",
"version": "1.0",
"manifest_version": 2,
"permissions": [
"activeTab"
],
"browser_action": {
"default_icon": "icon.png"
},
"background": {
"scripts": ["background.js"]
}
}
background.js
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(tab.id, {
allFrames: true,
file: "content_script.js"
}, function() {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
}
});
});
content_script.js
var x=document.querySelectorAll("._1v30.clearfix ._1v34");
y=1;
for(var i in x)
{if(y<5000){x[i].click();
y++;}
else{break;}
}
any ideas or any usefull converter???
Related
i'm trying to create a new tab from Firefox extension, but it doesn't works.
manifest.js:
{
"manifest_version": 2,
"name": "nafy",
"version": "1.0",
"description": "NaFy",
"icons": {
"48": "icons/icon_48.png",
"96": "icons/icon_96.png"
},
"content_scripts": [
{
"matches": ["*://*.ebay.de/*"],
"js": ["background.js"]
}
],
"permissions": [
"tabs"
]
}
background.js:
createNewTab();
function onCreated(tab) {
console.log('Created new tab: ${tab.id}');
}
function onError(error) {
console.log('Error: ${error}');
}
function createNewTab()
{
let newTab = browser.tabs.create({
url:"https://www.ebay.de"
});
newTab.then(onCreated, onError);
};
What I'm doing wrong? (Everything works as expected in Chrome.)
Your background.js file is not actually a background script despite it's name, it's defined in your manifest.json as a content script.
Content scripts don't have access to the tabs API (see list of accessible APIs here).
To fix that, you need to move your background.js to be an actual background script:
{
"manifest_version": 2,
"name": "nafy",
"version": "1.0",
"description": "NaFy",
"icons": {
"48": "icons/icon_48.png",
"96": "icons/icon_96.png"
},
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs"
]
}
Does anyone here have experience integrating push notifications on iOS on OneSignal with mobile apps built using Expo?
I have an app which opens a WebView and this WebView handles all the navigation (i.e. no app routes, instead web routes). The issue is that upon clicking a notification from OneSignal containing a launchURL (a web URL which is supposed to open in the WebView inside the app which I have handled programmatically), a bottom sheet (with a button "Done" on top-right) opens up instead.
You can view the video of the issue here.
My app.json:
{
"expo": {
"name": "Engage | Dev",
"scheme": "fudrengage",
"slug": "fudr-engage-app",
"version": "1.0.14",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "https://assets.fudr.in/assets/images/splash.png",
"resizeMode": "cover",
"backgroundColor": "#EB9658"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "in.fudr.devengage",
"associatedDomains": ["applinks:devengage.fudr.in"]
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "in.fudr.devengage",
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "devengage.fudr.in",
"pathPrefix": "/*"
}
],
"category": [
"BROWSABLE",
"DEFAULT"
]
}
]
},
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": [
[
"onesignal-expo-plugin",
{
"mode": "development",
"devTeam": "XXXXXX"
}
],
["./plugins/withAndroidVerifiedLinksWorkaround"]
],
"notification": {
"icon": "./assets/notification-icon.png",
"color": "#EB9658",
"androidMode": "default",
"androidCollapsedTitle": "Updates from Fudr",
"iosDisplayInForeground": true
},
"extra": {
"eas": {
"build": {
"experimental": {
"ios": {
"appExtensions": [
{
"targetName": "OneSignalNotificationServiceExtension",
"bundleIdentifier": "in.fudr.devengage.OneSignalNotificationServiceExtension",
"entitlements": {
"com.apple.security.application-groups": [
"group.in.fudr.devengage.onesignal"
]
}
}
]
}
}
},
"projectId": "xxxxxx"
}
}
}
}
Testing environment:
"react-native-onesignal": "4.4.1"
"onesignal-expo-plugin": "1.1.1"
"expo": "46.0.7"
iOS 16
"react-native": "0.69.5"
As per the OneSignal docs here, the launchURLs that trigger the browser in iOS as well as Android, can be suppressed by adding "OneSignal_suppress_launch_urls": true in the infoPlist key the ios section config in app.json
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.example.sub",
"associatedDomains": ["applinks:sub.example.com"],
"infoPlist": {
"OneSignal_suppress_launch_urls": true
}
},
My App.js was already handling launchURLs inside the WebView as shown below:
export default App = () => {
OneSignal.setAppId("xxxxxx");
const webviewRef = useRef(null);
const [webviewSourceURL, setWebviewSourceURL] = useState("");
useEffect(() => {
// Method for handling notifications opened
OneSignal.setNotificationOpenedHandler((notification) => {
const notificationId = notification?.notification?.notificationId ?? "";
const notificationLaunchUrl = notification?.notification?.launchURL;
const launchURL =
notificationId && notificationLaunchUrl
? `${notificationLaunchUrl}?notificationId=${notificationId}` // Append notificationId as a query parameter to generate a unique URL everytime a new notification is opened; this helps WebView know that it's a new visit
: "";
if (notificationId && launchURL) {
setWebviewSourceURL(launchURL);
}
});
}, []);
return() {
<WebView
ref={webviewRef}
originWhitelist={["*"]}
source={{
uri: webviewSourceURL || FALLBACK_URL,
}}
style={{ marginTop: 20, marginBottom: 5 }}
startInLoadingState={true}
renderLoading={LoadingIndicatorView}
onMessage={onMessage}
/>
}
}
I check out the latest code from Swagger UI 3.25.0 on github and add some features like saving and loading requet data. It works fine with Swagger 2.0 doc which has a json file like this
{
"swagger":"2.0",
"info":{
"version":"1.0",
"title":"Order api",
"description":"Order api"
},
"paths":{
"/api/v1/internal/orderdispatch/DispatchOrder/DispatchOrdersByIdList":{
"post":{
"tags":[
"Myaz.OrderDispatch.API.Controllers/DispatchOrder"
],
"operationId":"POST_api_v1_internal_orderdispatch_DispatchOrder_DispatchOrdersByIdList",
"consumes":[
"application/json-patch+json",
"application/json",
"text/json",
"application/*+json"
],
"produces":[
"application/json"
],
"parameters":[
{
"name":"salesOrderIdList",
"in":"body",
"required":false,
"schema":{
"uniqueItems":false,
"type":"array",
"items":{
"type":"string"
}
}
}
],
"responses":{
"200":{
"description":"Success"
}
},
"deprecated":false
}
},
}
}
But it seems that it can't open the OAS 3.0 doc which has the following structure.
{
"openapi": "3.0.1",
"info": {
"title": "My API",
"version": "v1"
},
"paths": {
"/api/v1/OrderRouter/SalesOrder/CreateSalesOrder": {
"post": {
"tags": [
"SalesOrder"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Myaz.ERP.Model.OrderRouter.ViewModel.SalesOrderViewModel"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/Myaz.ERP.Model.OrderRouter.ViewModel.SalesOrderViewModel"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/Myaz.ERP.Model.OrderRouter.ViewModel.SalesOrderViewModel"
}
}
}
},
"responses": {
"200": {
"description": "Success"
}
}
}
},
}
}
Currently I'm using asp.net core 3.1 which only support OAS doc. So how can I use swagger UI to show OAS 3.0 doc?
Thanks in advance.
I am new to WEBIDE, I am trying to consume northwind odata services, but so far I have been unsuccessful. Please see my code & help.
connection test on destination also was successful. but still I am getting error:
/V3/Northwind/Northwind.svc/$metadata", statusCode: 404, statusText:
"Not Found", headers: Array(0), body: "The resource you are looking
for has been removed,… its name changed, or is temporarily
unavailable."} responseText:"The resource you are looking for has been
removed, had its name changed, or is temporarily unavailable."
statusCode:404 statusText:"Not Found"
proto:Object
any suggestions, what I might be doing wrong?
neo-app.json:
{
"path": "/destinations/northwind",
"target": {
"type": "destination",
"name": "northwind"
},
"description": "Northwind OData Service"
}
manifest.json:
"sap.app": {
"id": "Mod3Act3",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "1.0.0"
},
"dataSources": {
"northwind": {
"uri": "/V3/Northwind/Northwind.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
},
"sap.ui5": {
"rootView": {
"viewName": "Mod3Act3.view.Main",
"type": "XML"
},
"dependencies": {
"minUI5Version": "1.30.0",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.layout": {},
"sap.ushell": {},
"sap.collaboration": {},
"sap.ui.comp": {},
"sap.uxap": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"": {
"dataSource": "northwind"
}
},
"resources": {
"css": [{
"uri": "css/style.css"
}]
}
}
controller
var url = "/V3/Northwind/Northwind.svc";
var oModel1 = new sap.ui.model.odata.ODataModel(url, true);
sap.ui.getCore().setModel(oModel1, "categoryList");
issue was with manifest.json.
"dataSources": {
"northwind": {
"uri": "/destinations/northwind/V3/Northwind/Northwind.svc/",
"type": "OData",
"settings": {"odataVersion": "2.0" }
}
}
this worked
please try the example from the sapui5 walk through:
manifest.json
{
"_version": "1.8.0",
"sap.app": {
...
"ach": "CA-UI5-DOC",
"dataSources": {
"invoiceRemote": {
"uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
},
"sap.ui": {
...
},
"sap.ui5": {
...
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "sap.ui.demo.walkthrough.i18n.i18n"
}
},
"invoice": {
"dataSource": "invoiceRemote"
}
}
}
}
controller
...
var oModel = this.getView().getModel("invoice");
...
please be aware of the accepting of the certificate due to the https connection and the same origin policy both mentioned in the linked walk through example.
I'm using Edge on Windows 10 v1703, build 15063.296.
The documentation (https://learn.microsoft.com/en-us/microsoft-edge/extensions/api-support/supported-apis) states, that the API tabs.captureVisibleTab is available.
But when I use it in the background script, I'm getting the following error:
API Call 'tabs.captureVisibleTab' is not supported in Edge.
The code is:
browser.tabs.captureVisibleTab(currentTab.windowId, {format: "png"}, function (data) {});
Am I missing something?
UPDATE:
this is my manifest file (ported from Chrome):
{
"author": "Evgeny Suslikov",
"background": {
"page": "background.html",
"persistent": true
},
"browser_action": {
"default_icon": {
"19": "images/sss_19.png"
},
"default_title": "FireShot - Capture page",
"default_popup": "fsPopup.html"
},
"commands": {
"last-used-action": {
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
},
"description": "__MSG_options_label_last_action_hotkey__"
}
},
"default_locale": "en",
"description": "__MSG_application_description__",
"icons": {
"16": "images/sss_16.png",
"32": "images/sss_32.png",
"48": "images/sss_48.png",
"128": "images/sss_128.png"
},
"Key": "B5SSrXXpDZAoT8SQ4vAzNeTQ1tBC2Z24nx+hHZXfykmVYfMy5aOwPkf0Hbt7SXlKbprwV0GwrYgCwIDAQAB",
"manifest_version": 2,
"name": "__MSG_application_title__",
"offline_enabled": true,
"optional_permissions": [
"tabs",
"<all_urls>",
"downloads"
],
"options_page": "fsOptions.html",
"permissions": [
"activeTab",
"tabs",
"contextMenus",
"nativeMessaging"
],
"short_name": "FireShot",
"version": "0.98.92",
"web_accessible_resources": [
"images/*.gif"
],
"-ms-preload": {
"backgroundScript": "backgroundScriptsAPIBridge.js",
"contentScript": "contentScriptsAPIBridge.js"
},
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["scripts/fsUtils.js", "scripts/fsSelection.js", "scripts/fsLinks.js", "scripts/fsContent.js"]
}]
}
In my fsBackground.js page I do the call:
browser.tabs.captureVisibleTab(windowId, {format: "png"}, function (data) {});
I get the following error: click to see screenshot...
That function is supported starting from Edge 15. On previous versions it was still unsupported, even though the documentation said differently.
Make sure to download the latest version of Microsoft Edge Extension Toolkit and to regenerate the bridge files with it.
You can look at the generated backgroundScriptsAPIBridge.js file to see what's changed.
Previous versions (unsupported):
captureVisibleTab(windowId, options, callback) {
bridgeLog.LogUnavailbleApi("tabs.captureVisibleTab");
}
New version (supported):
captureVisibleTab(windowId, options, callback) {
bridgeLog.DoActionAndLog(() => {
myBrowser.tabs.captureVisibleTab.apply(null, arguments);
}, "tabs.captureVisibleTab");
}