How to install a gadget on wikidata? - wikidata

In my own local wikidata, how can I install a new gadget, say, slurpInterwiki? It is the kind of gadget that I want (js file, enable on Preference of a user)
In the Preference of user currently, I can only see 2 gadgets which are checkConstraints and authorityControl

Wikibase (software of Wikidata) is an extension of MediaWiki, thus installing a gadget on Wikibase/Wikidata works the same way as on any other MediaWiki installation.
Generally, you need to perform two steps:
Copy the JavaScript code of the gadget to your wiki. The page title must have the form "MediaWiki:Gadget-gadget_name"
Add a new line to [[MediaWiki:Gadgets-definition]] with the content mygadget[ResourceLoader|dependencies=]|mygadget.js|mygadget.css
The dependencies of slurpInterwiki are defined in https://www.wikidata.org/wiki/MediaWiki:Gadgets-definition. Easiest way is just to copy the relevant line on this page to the corresponding page on your wiki.
More detailed instructions to install gadgets can be found on https://www.mediawiki.org/wiki/Extension:Gadgets.

Related

Customize URL of a R bookdown site

I have written a textbook using bookdown and published it to bookdown.org/connect via RStudio. The URL is currently of the format
https://bookdown.org/connect/#/apps/x0x0x0x0z1z2z3z4etcetc/ [not the actual link!]
I believe there is a way to customize this URL to be e.g. bookdown.org/mybook. I have looked up some help guides that you can edit this by going to your access site, and clicking on the ContentURL box. When I do that it highlights the URL, but I am not able to edit it in any way - just copy it.
Is there an easy way to customize the URL?
You can use bookdown's publish_book function to add the name of your book, or the Publish to Server button in RStudio allows for a Title input field where you can also add the name of your book that will be a part of the vanity URL. Your RStudio Connect profile name should go before the name of your book, so the format would be bookdown.org/RStudio Connect profile name/name of your book/

Create page structure one time for all languages

I'm testing the Django CMS and I'm looking for a way to create the pages one time for all languages. Currently I have to create a new page for each languages and the content/plugin/structure is not shared between the different languages.
Is there a way to achieve this?
Thanks in advance
The built-in management command ./manage.py cms copy lang copies the entire page tree from one language to another. The page tree stays unchanged and the plugin trees are transferred. That is fine if you want to bootstrap a new language for the entire site.
If you want to copy the plugin trees for only one page, you can use the language menu from the toolbar: Language -> Copy all plugins if you are viewing the target language. This is fine, if you only have one page.
If you want to bootstrap a language for a page tree, i.e. a page and all its children, then you either have a lot of clicking to do, or use this short management command I created based on the original DjangoCMS ./manage.py cms copy long command. It allows to specify a page to copy either by its id or by its name in the source language (attention: it has to be unique).
Copy this snippet into any of your application's command folder: my_app/management/commands/. Once you've copied the file you'll have a new Django management command available: ./manage.py copylang. Usage examples:
./manage.py copylang --from-lang=en --to-lang=nl --tree="Home"
./manage.py copylang --from-lang=en --to-lang=nl --tree_id=36 --force
The page id needed for the --tree_id option can be easily inferred from the page admin by hovering over the page's preview icon. The page id is part of the link: .../page/page_id/lang/preview/...
If you leave out the --treeand the --tree_id options the command will revert to DjangoCMS's original cms copy lang behaviour.
The management command provided by #Fabian is quite useful.
I updated the command code here to reflect the changes in django-cms API:
# pages = [head] + list(head.children.drafts())
pages = [head] + list(head.get_child_pages().drafts())
Tested against django-cms 3.5.3 and 3.7.4.
All credits go to #Fabian.

Injecting a custom stylesheet into a site via Chrome Devtools

Here's the plan: I'm trying to customize a site. I want to create and edit a CSS file locally (on my own text editor) and inject it into the page using the new Workspace and Filesystem features in DevTools.
These two features seem to work quite well, except they only allow you to map certain local files to network files.
I want to create a new file and inject that into the page, not modify an existing (loaded) stylesheet.
Anybody have any ideas?
U can use the chrome extentions for that...create an extention and everytime a page loads you can add that to it.I had done it earlier,modifying the contents of www.imdb.com for a extention of mine called Movie mapper,unfortunately Chrome store removed it after 1 yr.You want the code ? I can share

How to make sure changes to a Wordpress plugin won't be lost on plugin update?

I'm pretty sure I've read somewhere that you can actually move the main plugin *.php file to somewhere else (I assume under your theme directory) to have it safe in case you made changes to it and your plugin updates. I tried Google but I can't find anything. Google page with good results will suffice.
I've just experienced a situation where my 2 plugins which had its layout changed and accommodated my needs and I want to make sure it doesn't happen again. Apart from having the main file in another location, is there a way to move along any CSS and JS files as well?
In Concrete5 CMS there is a nice way of doing this, by creating a new folder inside a block of an addon (may be regarded as a WP plugin), inside of which you can create copies of main file, any CSS and JS files and then you can simply edit them and choose that template for a page location you are using that block in.
I assume there is no such thing in Wordpress but how close can I get?
UPDATE: I found where I applied that advice on creating a new instance of the file then moving it to the theme directory.
The plugin in question was HL-Twitter. These are the plugin files:
admin.php
archive.php
functions.php
hl_twitter.php
hl_twitter_archive.php
hl_twitter_widget.php
import.php
widget.php
Now, this is the top contents (commented out) of the hl_twitter_widget.php:
Widget Theme for HL Twitter
To change this theme, copy hl_twitter_widget.php
to your current theme folder, do not edit this
file directly.
Available Properties:
$before_widget
$after_widget
$before_title
$after_title
$widget_title
$show_avatars
$show_powered_by
$num_tweets: how many tweets to show
$tweets: array of $tweet
$tweet: object representing a tweet
$tweet->twitter_tweet_id
$tweet->tweet
$tweet->lat
$tweet->lon
$tweet->created
$tweet->reply_tweet_id
$tweet->reply_screen_name
$tweet->source
$tweet->screen_name
$tweet->name
$tweet->avatar
$user: represents the Twitter user (ONLY SET IF SHOWING A SINGLE USERS TWEETS!)
$user->twitter_user_id
$user->screen_name
$user->name
$user->num_friends
$user->num_followers
$user->num_tweets
$user->registered
$user->url
$user->description
$user->location
$user->avatar
So I was wrong about copying the main file (in this case hl_twitter.php), but still - this enabled me to edit the file outside the plugin directory and the system somehow checks for its existence and picks it up if exists.
If this behavior something that is natively supported by Wordpress or it has been integrated in the plugin itself?
With themes, Wordpress has a concept of "child themes" which allows exactly that: to keep changes separate from main theme, in case it changes.
I haven't yet found a way to do this with plugins.
I'm using a few tactics myself:
I bump plugin version to a very high number like 99.9. This way Wordpress won't ever update the plugin.
Store my plugins in version control (i use git, but it doesnt matter), this allows you to update the plugin, run the 'diff' tool and see what changes happend. If you don't like you just revert like it would be a bad code you've written. But this approach requires a bit of skill.
Are you talking about running parts of a modified 3rd party plugin, and an updated version, at the same time?
That's not going to be possible. There is no magical method of "preserve my changes and transfer them into the new version automatically". The way to go here is doing a diff between the edited version and the update, and integrating the changes in the actual source files.
The bottom line is, if you manually edit a third party plugin, you're in for manual review (and possibly rework) once an update takes place. That's why it's usually not a good idea to extensively modify third party plugins.
Well in fact, yes! There is some kind of way.
You have to remove the to be modificated plugin's original actions/filters and then add your altereted actions/filters.
If the desired plugin is even coded in OOP you can just inherit the whole class and rewrite the wanted functions (oh sorry: "methods". we're talking about OOP ;) ). Instantiate your inherited class and rest as above.
Maybe there are better ways! I already search for a method so that the original class won't even get loaded but our altered one instead but I'm no John Carmack.

Adding image to project description in google code

I want to update a background image in google code projects.I searched their wiki, it talks about pointing image to an external world.Is there anyway we can upload the image to google code and provide a link?
I got the solution.First you need to upload the image to 'Download' area.After that, give the image url like this.
<img src="http://yourgoogleproject.googlecode.com/files/name of your image.PNG" alt="Logo"/>
You have to paste the above code inside apostrophe(') and end with apostrophe and can paste this in project description of your project summary tab.(I have just added here, in my case)
The file uploaded will go under 'files' folder of your project automatically.
This answer is no longer correct. Google Code removed the downloads option in May 2013, due to misuse. You can, as they suggest, move your files to Google Drive and link to them from there, which is fine for project downloads, but for items such as images in wiki pages or the project home page, I recommend checking the images into your source repository and linking to them. For example, ig you use a mercurial repository and your files are checked into docs/images, then:
http://yourproject.googlecode.com/hg/yourproject/docs/images/logo.png
should work.

Resources