Can the S+program obtain the attribute values of the specified elements in
Fri Dec 02 2022 19:24:37 GMT+0000 (Coordinated Universal Time)
Saved by
@savabeh191
// Callback used by the HTML window we create below
function attributeWindowCallback(val)
{
let obj = JSON.parse(val);
if (obj.StrokesPlusHTMLWindow) {
var handle = new IntPtr(parseInt(obj.StrokesPlusHTMLWindow.Handle))
sp.StoreHandle("attributeWindowHandle",handle);
}
else if (obj.action)
{
switch(obj.action) {
case "Close":
sp.WindowFromHandle(sp.GetStoredHandle("attributeWindowHandle")).SendClose();
break;
}
}
}
// Opens an HTML window to a URL (this post), waits 2 seconds, then looks for a div and shows an
// alert with the html of the element, then closes the HTML window
sp.HTMLWindow("Find Element", //Window title
"https://forum.strokesplus.net/posts/t8539-Can-the-Sprogram-obtain-the-attribute-values-of-the-specified-elements-in",
"attributeWindowCallback", //message callback
`setTimeout(function(){ // Script to execute on document create
alert($('.selectionQuoteable').html());
window.chrome.webview.postMessage({ action: 'Close'});
}, 2000);`, // Waits 2 seconds, then gets an element via jQuery
"", // window ID
false); // include jQuery/bootstrap - ignored for file/url
content_copyCOPY
https://forum.strokesplus.net/posts/t8539-Can-the-Sprogram-obtain-the-attribute-values-of-the-specified-elements-in
Comments