I'm working on a firefox extension and I am trying to make it add an image stored with the extension (the kind that you access using chrome://, although I'm not sure if there is an official name)
body.innerHTML+="<div style=\"position:fixed;top:0em;left:0em;background-color:white;\"><img src=\"chrome://tumblrscrollr/content/save.png\" /></div>";
This should put save.png at the top left of the page, however nothing appears there (not even the white background). If I replace chrome://tumblrscrollr/content/save.png with a url on the internet, the image displays properly. If I visit chrome://tumblrscrollr/content/save.png directly in the address bar, it displays fine. I assume there's some security thing or something going on that doesn't allow an img tag in a page to access an extension's files, but since google doesn't support symbols and any search for 'chrome' just returns the browser, I am finding it very hard to find any answer.
You need to use the contentaccessible flag for the tumblrscrollr chrome package, this will allow web pages to use its images. Meaning that your chrome.manifest file should have a line like this:
content tumblrscrollr foo/bar contentaccessible=yes
Note that this flag always has to be specified on the content entry but it affects any address starting with chrome://tumblrscrollr/ meaning also chrome://tumblrscrollr/skin/ for example.
Btw, you shouldn't add elements like that - this makes the browser to parse the entire document body again which is slow and might cause all kinds of side-effects. If you need to add a single element then just create that element and add it, e.g.:
var element = body.ownerDocument.createElement("div");
element.setAttribute("style", "position:fixed;top:0em;left:0em;background-color:white;");
element.innerHTML = "<img src=\"chrome://tumblrscrollr/content/save.png\" />";
body.appendChild(element);
Related
I want to parse tables spead over many pages from the below url
https://www.marketscreener.com/tools/stock-screener/
However, the page url address dynamically changes on every click (even though the data in the tables remains unchanged). I am not very well versed with recent website/webpage development technologies. I have some experience with requests/lxml.xpath but how do i pass the dynamic url address to 'requests.get' I tried to get the source container from the Network tab in chrome, but that too doesn't seem to work.
Edit_1:
further to #Andrej Kesely comments, basically my desired output is the href data contained in .//table//tbody/td/tr//a href which I can get with routine lxml.xpath function. My real challenge precedes that, it is that the url address keeps dynamically changing. So, I am having trouble passing static url at requests.get level. Hope I am making myself clear.
I'm trying to use the highlighting feature on Webmaster tools. I got done filling it out for my page, but when I go and try to create the page set, it doesn't find any files matching the pattern.
The default pattern that google chose is:
http://www.example.com/*/*/*/*
That's not good enough because that's everything on my site.
What I want is this:
http://www.example.com/Team/Schedule/*/*
It can't find this. The first asterisk is just the id, and the second * is the name associated with that id.
I tried adding this:
http://www.example.com/Team/Schedule/*
It can't find anything here either.
This DOES work
http://www.example.com/Team/*/*/*
So, why doesn't the pattern that I want get recognized? I've even tried copying and pasting in the "Team/Schedule" portion to make I didn't misspell, but that still doesn't work.
Edit:
the "template" path that I used for the highlighting looks like this:
http://www.example.com/Team/Schedule/105/Bears
And similar pages would be:
http://www.example.com/Team/Schedule/52/Vikings
This was a result of Google containing an old cached version of my page structures. I had just recently updated the structure, and Google had not re-crawled to get those changes.
I'm working in a Rails 3.1.8 app and I'm having a problem creating a Twitter share button that produces the text I want. Here is the erb code for the button:
Tweet
This button appears on a page that contains content produced by a particular user. Let's call the user "sam". The text this code produces to be shared on Twitter is:
[some_text] [url of current page] via #sam
I would like to remove the "via #sam", but I cannot figure out how. If I explicitly set data-via I can change the user that the "via" phrase refers to, but I cannot make it disappear.
This support page suggests that omitting the data-via tag should do the trick, but I have found that it does not.
I've searched around the app to try to find a place where this parameter is being set, but I haven't found anything. However, as I'm pretty green with Twitter stuff, I may not be searching for the right thing.
Thanks in advance for your help, and do let me know if I can provide additional info.
ADDENDUM: I've tried add setting data-via to various values, including false, "false", and "", as well as appending ?via= and analogous values to the share URL. Each of these attempts resulted in a bogus via phrase (e.g. "#false"), or a default to "#sam".
Maybe you have an old version of the Javascript being included or cached.
Taking examples from https://dev.twitter.com/docs/tweet-button works as expected when omitting the data-via attribute.
Tweet
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
Working example: http://jsbin.com/uxopur/2/
The scenario:
I have an ApEx page which pulls a record from a table. The record contains an id, the name of the chart (actually a filename) and the code for an image map as an NVARCHAR2 column called image_map.
When I render the page I have an embedded HTML region which pulls the image in using the #WORKSPACE_IMAGES#&P19_IMAGE. substitution as the src for the image.
Each chart has hot spots (defined in the image_map html markup) which point to other charts on the same ApEx page. I need to embed the:
Application ID (like &APP_ID.)
Session (like &APP_SESSION.)
My problem:
When I try to load the &APP_ID as part of the source into the database it pre-parses it and plugs in the value for the ApEx development app (e.g. 4500) instead of the actual target application (118).
Any help would be greatly appreciated.
Not a lot of feedback - guess I'm doing something atypical?
In case someone else is trying to do this, the workaround I ended up using was to have a javascript run and replace some custom replacement flags in the urls. The script is embedded in the template of the page and assigns the APEX magic fields to local variables, e.g.:
var my_app_id = '&APP_ID';
Not pretty, but it works...
Ok - I think I've left this open long enough... In the event that anyone else is trying to (mis)use apex in a similar way, it seems like the "apex way" is to use dynamic actions (which seem stable from 4.1.x) and then you can do your dynamic replace from there rather than embedding js in the page(s) themselves.
This seems to be the most maintainable, so I'll mark this as the answer - but if someone else has a better idea, I'm open to education!
I found it difficult to set a dynamic URL on a link to another page - directly - attempting to include the full URL as an individual link target doesn't work, at least in my simplistic world, I'm not an expert (as AJ said: any wisdom appreciated).
Instead, I set individual components of the url via the link, and a 'Before Header' PL/SQL process on the targeted page to combine the elements into a full url and assign it to the full url page-item:
APEX_UTIL.set_session_state(
'PG_FULL_URL',
'http...'||
v('PG_URL_COMPONENT1')||
v('PG_URL_COMPONENT2')||
'..etc..'
);
...where PG_FULL_URL is an item of Type 'Display Image', 'Based On' 'Image URL stored in Page Item Value'.
This is Apex 5.1 btw, I don't know if some of these options are new in this release.
I am using the Radius Tag System (from the RadiantCMS) for a content engine in my current applciation. Everything has worked really well, but now I am experiencing issues when using FBML inside my content.
When I supply a tags like the following to my template:
<fb:profile-pic uid="loggedinuser" size="square"></fb:profile-pic>
Radiant gets confused, incorrectly parsing the close tag and outputting:
<fb:profile-pic uid="loggedinuser" size="square"> /fb:profile-pic>
... which in turn breaks the FBML parsing engine.
I am not using the fb prefix for Radius, so there is no clash, and indeed, I can get many of the tags to work by using the self-closing format:
<fb:profile-pic uid="loggedinuser" size="square"/>
Self-closing is fine in many cases, but being able to provide content for a tag means that there is content visible while the Facebook connect engine loads.
A quick analysis showed, that Radius has a problem with closing tags that contain namespaces. This is in no way a Facebook only problem.