Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
web-monkey-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hugo Hörnquist
web-monkey-scripts
Commits
b218fdc6
Commit
b218fdc6
authored
2 years ago
by
Hugo Hörnquist
Browse files
Options
Downloads
Patches
Plain Diff
Add mobile wikipedia.
parent
36c3f3d2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mobile-wikipedia/index.js
+65
-0
65 additions, 0 deletions
mobile-wikipedia/index.js
with
65 additions
and
0 deletions
mobile-wikipedia/index.js
0 → 100644
+
65
−
0
View file @
b218fdc6
// ==UserScript==
// @name Go To mobile wikipedia
// @namespace http://hugo.hornquist.se
// @match https://*.wikipedia.org/wiki/*
// @grant none
// @version 1.0
// @author hugo@lysator.liu.se
// @description Go To mobile wikipedia
// @source https://git.lysator.liu.se/hugo/web-monkey-scripts/-/tree/master/mobile-wikipedia
// @updateURL https://git.lysator.liu.se/hugo/web-monkey-scripts/raw/master/modile-wikipedia/index.js
// @downloadURL https://git.lysator.liu.se/hugo/web-monkey-scripts/raw/master/mobile-wikipedia/index.js
// ==/UserScript==
(
function
()
{
'
use strict
'
;
const
translations
=
{
'
sv
'
:
{
'
Go to mobile site
'
:
'
Gå till mobilsida
'
,
'
Mobile
'
:
'
Mobil
'
,
'
Alt
'
:
'
Alt
'
,
'
Shift
'
:
'
Skift
'
,
}
}
function
translate
(
to
,
src
)
{
let
dict
=
translations
[
to
];
if
((
dict
=
translations
[
to
]))
{
return
dict
[
src
]
||
src
}
else
{
return
src
}
}
const
nav_btn
=
'
m
'
let
pageLang
=
document
.
documentElement
.
lang
;
let
browserLang_
=
navigator
.
language
.
split
(
'
-
'
);
let
browserLang
let
browserRegion
=
null
if
(
browserLang_
.
length
==
2
)
{
browserLang
=
browserLang_
[
0
]
browserRegion
=
browserLang_
[
1
]
}
else
{
browserLang
=
browserLang_
.
join
(
'
-
'
)
}
let
li
=
document
.
createElement
(
'
li
'
);
li
.
id
=
'
ca-nstab-mobile
'
li
.
classList
.
add
(
'
mw-list-item
'
)
let
a
=
document
.
createElement
(
'
a
'
);
a
.
href
=
document
.
querySelector
(
'
#footer-places-mobileview a
'
).
href
a
.
title
=
`
${
translate
(
pageLang
,
'
Go to mobile site
'
)}
[
${
translate
(
browserLang
,
'
Alt
'
)}
+
${
translate
(
browserLang
,
'
Shift
'
)}
+
${
nav_btn
}
]`
a
.
accesskey
=
nav_btn
let
span
=
document
.
createElement
(
'
span
'
);
span
.
textContent
=
translate
(
pageLang
,
'
Mobile
'
)
a
.
appendChild
(
span
)
li
.
appendChild
(
a
)
let
ul
=
document
.
querySelector
(
'
#p-namespaces .vector-menu-content-list
'
)
ul
.
appendChild
(
li
)
})();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment