Looking for Greasemonkey Scriptwriting basics/tutorial [closed] - firefox

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I have been searching the internet for days now trying to find out how to write my own script, one more complicated than the "Hello World" script.
I understand for the most part how to find specific elements using firebug (I have Firefox). I understand the metadata and how to do all that.
I do not however understand how I am supposed to get whatever I want into the page. Be it links or tabs for Facebook or other sites.
Can anyone help me get a full tutorial/guide that is up to date and easy to understand for total scriptwriting beginners?

From what you have described in the, I suspect that anything that meets your criteria will actually just be a Javascript tutorial with some extra Greasemonkey-specific sections / focus
There's not links to many guides and tutorials (might add them in later) but I really think that what you need is a beginner's guide to Javascript such as sections 1-8 (except 5) of the one provided at the Mozilla Developer Network.
Greasemonkey stuff:
Specifically, the Greasemonkey-related topics that you will need to read up on are related to the DOM, altering styles of DOM nodes, and the Greasemonkey API. All else that you need will be generic Javascript that will be specific to the script you are creating.
DOM Manipulation:
Inserting / editing / deleting "nodes" ( in the HTML code) - for example, <a>nchors, <div>s, <img>s
This is how the extra links and tabs etc are added into the page.
Specifically, look into appendChild(), createNode() and insertNodeBefore().
DOM Traversal
Moving around the DOM (HMTL Document) and selecting where to insert the new nodes / selecting which nodes to editor delete.
Specifically, look into XPATH, getElement(s)By_____, parentNode, querySelectorAll()
Introduction to using XPath in JavaScript - XPath | MDN
Node.parentNode - Web APIs | MDN
CSS Using Javascript
The basics of changing the CSS of a node are to either use .setAttribute() to set the 'style' attribute, or to alter specific CSS properties using nodeReference.style.cssAttribute = 'value'.
Greasemonkey API
Again, this stuff will be specific to what you want to use within the script you create but the basics include GM_getValue(), GM_setValue(), GM_log()
Greasemonkey Manual:API - GreaseSpot Wiki

Look at Greasemonkey Hacks archived, especially the part Avoid Common Pitfalls archived - I'm often returning to the latter.
Edit: the original links are dead, added links to recent archived version in superscript.

Related

Hide certain posts on tumblr home [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I would like to hide certain posts on my tumblr homepage that have the a specific tag (#journal). I've already tried some codes, but it didn't work.
Here is my actual HTML code:
pastebin.com/JT4KtyVz
My tumblr:
http://heynotspecial.tumblr.com/
Do you guys know how to do that?
Sorry, not used to post code here :(
You need to identify a commonality for posts that have the Journal # tag. I suspect there could be a class name applied to posts with this tag.
You can apply this rule in your CSS stylesheet to hide div elements with the infscrjournal classname.
{block:HomePage}
div[class~=infscrjournal] {
display: none;
}
{/block:HomePage}
**** you need to surround the code with the homepage variable to make sure it only appears on the first page and nothing else. Try that

best way to handle complex page layout in joomla

I have to convert a static site for a client and it has to retain the exisiting layout.
Fortunately, most of the pages don't have to be editable, so for those I was going to use more or less the existing html.
The challenge I am having is that for many of the pages that do need to be editable, the content is laid out in columns (2, 3 and sometimes mixed)
This ( http://globalstrategies.org/index.php/give/hope-partners ) is an example of a page like that, and you can see others on the site where the layout is relatively complex.
I had thought of creating a jce stylesheet that would at least layout the page in the editor in a reasonable way (a bit like a responsive site, by having the columns stacked one after the other) , but I am concerned that my client may accidentally delete the surrounding classes/divs that create the more detailed structure.
I'm pretty familiar with Joomla and have built quite a few sites, but I've not used an cck tools and was hoping not to have to do that in this case, though maybe now is the time to learn.
Any advice / recommendations would be welcome !
Richard
Maybe ContentBuilder could do in your case, it's fairly easy and creates super-simple code, I've accomplished similar tasks with it. You provide the user with 3 fields (one per column) and create a layout for its display.
Another alternative is possibly even easier: you could override the use of the page functions in a template override of com_content/article, instruct the user to insert at most 2 page breaks, and use the page breaks to build the layout as you require.
If your sites is upgraded to the Joomla 3 you can use the build-in Bootsrap to do the layout.
You can find some more information how you can achieve this in the following page:
http://twitter.github.io/bootstrap/scaffolding.html#gridSystem

Converting a large User Control to Mvc [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Question: Are there any Mvc framework solutions that I can leverage to create a clean and concise approach that represents my user control that I am converting? (There are four major design considerations listed below)
This user control has a lot of explanatory text information within. I really want to avoid writing a helper method that is a mile long containing a ton of standard HTML and text.
This user control contains a Grid. I have written my on Grid control in Mvc but I have not had any experience as of yet with composition of html helpers in a clean fashion.
This control is only presented to the user as a result of uploading a spreadsheet for importing purposes.
The design needs to account for being in a standalone dll that is used in other projects.
I was considering the idea of using a Partial View. This would be preferable since it could make calls to the html helper to render my grid and contain the explanatory text.
However, I couldn't find examples online that really lent themselves to my scenario. So I not confident of the details.
Thanks for input in advance.
Explanatory text can be stored in a view model. It'll be stored in a
single place and it can easily point to a resource file with
localization (if needed)
Re-factoring. I can't get into more details as I haven't seen the code
If you opt-in for a partial view, you can render control with #Html.RenderPartial, #Html.EditorFor, #Html.DisplayFor depending on what kind of control this is. In my project I have controls for storing and displaying search criteria. So I have something on the lines of
#Html.EditorFor(model => model.CategorySearch, "CategorySearch")
I'm not sure about a seperate DLL, but if you have a clear seperation between a view and domain model, then you should be able to get away with copying your view model and view related components (e.g. partial view, editor/display templates etc)
I hope this helps

Like Button: Make Facebook NOT take specific images [duplicate]

This question already has answers here:
Closed 11 years ago.
I'd still like my users to have a choice of image to select when sharing links from my site but I would like to restrict certain images from showing in the Facebook sharer. I don't want to select a specific image using meta tags (this has been suggested often).
Would appreciate any help!
EDIT (9 Jul 2012): This question is not an exact duplicate to any others on stack overflow. I asked for a method to restrict images from showing without specifying OG or meta tags, unlike others who have simply asked how to show a specific image. Why do people on this site assume (and rate my question down) before even reading it carefully and considering whether it is a duplicate.
The only way to do this is to specify multiple og:image tags of images that you want to allow and then the user will be able to choose from the images you select.

Should you name all of your UI controls? What naming scheme do you use? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
This can be applied to any language/UI project. When the code is automatically generated, is there a need to name all of the UI controls? Presently I only name the ones I am referencing in code (although admittedly sometimes I get lazy and leave them). Or do you stick with the pre-generated names (textbox1, splitContainer1, menuStrip1, etc..)?
If you name them, how do you prevent overlap such as MyDataGridView1, MyDataGridView2, etc..
I only name the ones I reference too - most modern IDEs will easily rename a widget later if I need to reference it in code.
I usually give the names some meaning - accountDataView, currentBalanceDataView - it must relate to a concept like submitButton for the button that submits a form.
I always try to set GenerateMember to false for the controls I don't use in the code, but for the controls I do use in code, I usually choose meaningful names.
For example, if there was a button that submitted something then I would choose submitBtn. If there was a username textbox then I would call it usernameTxt. Etc, etc.
A small list:
Buttons: btn
Textboxes: txt
Labels: lbl
Checkboxes: chk
Radio buttons: rad
List boxes: lst
Dialogs: dlg
...but above all else, just use what makes sense.
I name the controls that I access and have experimented with using the "ux" prefix so that I can find them easily with Intellisense. That way if I can't remember the exact name of a control I know it at lease starts with ux. Also, if I change the control type, the name can stay the same. I came across this a while back, but can't seem to find the article about it now.
uxFirstName

Resources