Creating custom edit buttons for MediaWiki - javascript

Hi im trying to build a mediawiki extension which requires AJAX calls during editing a page. All I need is to add a new edit button on the edit page which displays a javascript popup editor which in turn makes the appropriate calls.
I need to know if it is feasible in Mediawiki, to inject javascrpt code into edit buttons.
Any kind of information or leads are welcome!

Ok clearly the question is very specific, tht no one cared to answer. so if some one else wants to know how to add custom edit buttons in Mediawiki, this is how I did it
I found a Mediawiki help page which asks the user to edit a particular javascript page located at http://(wiki-site-url)/Mediawiki:Comomn.js .
On closer inspection this is not an actual js page but a normal wikipage(stored in the database as wikitext) which is loaded by mediawiki during runtime. The site admin can edit this page by adding
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "<path-to-image-on-the-server>",
"speedTip": "Comment visible only for editors",
"tagOpen": "open tag",
"tagClose": "closing tag",
"sampleText": "Insert comment here"}
}
This can also be achieved for a single user by applying the same edit on the users own copy of the js file available at http://(wiki-site-url/User:(Your_username)/(skinname).js
Both the js pages could be created if they dont already exist.

The wiki way is to put an HTML button into a Widget and put your JavaScript there, or better yet in its own Gadget

Related

How should I render a widget with many links inside a blog so google don't penalize the blog?

We run a service (will not mention the URL, as this is not a pitch) and need advice on Google-viewing-links matters.
The service is for bloggers and allows them to create a "linkup" inside their blog post.
The linkup is like a mini pinterest inside their own blog where other users can add images/links/blogposts.
The widget that creates this linkup is a javascript snippet that does a remote call to our server. The response of the server is rendered inside the user's blog.
Now, the widget contains quite a few links. And we have set all links as nofollow so they don't look spammy in the eyes of google.
Going to google webmaster tools, I can see that the crawler can easily render the links even if they come from javascript.
So my question is: Is it better to
completely hide the widget from google
just leave it as it is, renderable with nofollow on the links
remove the links and create them only when someone clicks on them?
any other suggestion is appreciated!
Hiding of content including links can be considered as cloaking. If links are present on page there is no need to hide them.

how to add a topics to the website without editing the code

Hi guys i have a web site, there is a content I want let admin editing it "TEXT and pictures" without having to edit the code in order to add some topics,how i can do that i'm using ASP.net with c# is there to add a box like the box of inserting topic in stackoverflow
What you're saying is what a CMS (Content Management System) is for, and it seems that your website is just a simple website.
There's plenty of CMS options out there, since Wordpress (PHP) to the Umbraco (.NET) - plenty more on Google - and you need to shape your website into one of them, or, if you want to have the work... you need to develop your own system... add those textboxes and image selectors, save the choices to a database, and show the text and images from those saved choices...
best option is actually set up an empty CMS and replicate what you currently have, it's easier and you will get all from the start.

Hide WSS 3.0 Webpart Using JavaScript

I am using WSS 3.0 in my application. I am displaying a List as a DataView Webpart. My objective here is to make this webpart visible to a selected group of individuals. As there is no option for Target Audience in WSS 3.0, I went to edit Permissions for List and gave Read permissions only to selected users. This doesn't hide the web part from the page, rather shows an Access Denied message to other users.
Access denied. You do not have permission to perform this action or access this resource.
As I said, I want to hide this webpart, as in make it invisible on the web page from other users who do not have permissions to view it. As this message will be displayed only to those users who do not have permissions!, my approach is to search for the above message in the html and identify and hide the parentnode, thereby hiding the webpart.
I am not quite sure how to do this. Any ideas? Thanks in advance!
I'm going to assume you're in a situation where you can add additional web parts to the page and not trying to add JavaScript to the DataView Web Part directly. My suggestion won't work on a separate page if a Designer adds another view of this list.
Upload a blank .js file to your Site Assets. Add a Content Editor Web Part to your page, point it at that file. Add JQuery from a provider or host it yourself, adding the reference in your file. From there, you have 3 directions in which to work: first, explore the web part with Internet Explorer's F12 Developer Tools, keeping a particular eye on divs and tables with good unique ids, names, or classes that would solve your problem if hidden. Also keep an eye on the id of the div or table or cell or whatever that contains your access denied text. Second, (assuming you're new to JQuery) do some JQuery tutorials and then start playing with selecting the above items and, say, changing their background color. Once you have both of those, you're 90% there: (try to) select the object that would contain the access denied text, and if the innerHTML is present and equals that string, then set display:none for the div or tables to hide your web part. The third tool you have is editing the page directly with SharePoint Designer: you can toss a div with an id of your choosing around any xsl:template, which might help in your JQuery selecting.
I'm sorry I can't give you the specific code, since I'm not in a position to test it. If that changes, I'll try and give a more detailed response.
Old, misdirected answer: Do either of the answers here work for you? Alternatively, this answer has some great resources to solve your problem. Just change the message to an empty string.
Thanks Aron :D
I found the id for the webpart and hard coded it. It provided the solution, but I was hoping to programmatically fetch the id instead by searching the innerhtml, as I have more than one web parts that have to be hidden.
I found a partial solution here:
Hide SharePoint web part using javascript onclick method
I put a CEWP on the page and added the following script in it:
<script>
function hide()
{
var content = document.getElementById("webpartID").innerHTML;
var n = content.search("Access denied. You do not have permission to perform this action or access this resource");
if(n!=-1)
{ document.getElementById("webpartID").style.display="none";
}
}
_spbodyonloadfunctionnames.push("hide");
</script>
In my case, I picked up the webpart id from the aspx page or view source for the page.

Ajaxplorer Popup File Selector

I'm trying to use Ajaxplorer as a way to choose a file on the server and publish the file path in a form (basically linking the file to a db record). I want the behavior to work like CKFinder's popup functionality. I want the user to click a "choose file" button, Ajaxplorer appears in a new window, the user selects the file, and then the path to that file is sent back to the form and the popup is closed. I'm pretty sure that this is possible because the CKEditor plugin for Ajaxplorer seems to do just that.
I'm new to Ajaxsplorer, so I am just digging in. I was hoping that I could somehow pass a callback method to Ajaxplorer that would populate my field on select. However, it doesn't appear that I can do that based on the docs.
The other option looks like creating a plugin. I'm happy to do this, but the documentation is weak and it seems like others would have done this by now. So, before digging in to that for hours trying to learn the plugin system, I wanted to pose this question to the community. Is there documentation or a plugin for Ajaxplorer that will allow me to send selected file info from a popup window back to my form?
I was able to accomplish this by building a plugin. I have attached the URL to the plugin in case others may want similar functionality.
Ajaxplorer-Popup-Selector

Pagination with special loading function?

I was searching for a script or at least a code snippet but haven't really made any progress. Anyway, I'm looking for a script that works like a simple pagination javascript but it should be accessible by linking from anywhere in the document and by calling it with the URL (e.g. on www.abc.de/default.html#thirddiv the third page of the pagination is displayed). Further, the contents should be loaded upon request (when the user clicks on the link and enters the specific page of the pagination), so that cookies, that have been set or deleted in the same document earlier can be used later without reloading the entire page. Something like that is used on Facebook for calling contents and loading them.
I've found a script on CSS Tricks called BetterBlogroll but I don't really get my mind into this. A pagination script from DynamicDrive is already working very well on the page but my problem is that there should be running three of them on the same page and as I said, the content should be loaded upon the user's request.
The script I'd need does not has to be with loads of CSS, the best way would be plain javascript and only the required CSS and HTML data. Anything else just disturbs. If anyone can help me out here, I'd be very thankful.
Check out Ryan Bates's Railscasts #174 and #175. These two are not rails specific, and explain this well.

Categories

Resources