Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
node-slate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Hải Sơn
node-slate
Commits
cfa9f48d
Commit
cfa9f48d
authored
May 19, 2014
by
Robert Lord
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68 from bootstraponline/lang_default
Lang default
parents
34c6c69d
1e341563
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
lang.js
source/javascripts/app/lang.js
+8
-14
No files found.
source/javascripts/app/lang.js
View file @
cfa9f48d
...
...
@@ -21,6 +21,12 @@ under the License.
function
activateLanguage
(
language
)
{
if
(
!
language
)
return
;
var
hash
=
window
.
location
.
hash
;
if
(
hash
)
hash
=
hash
.
replace
(
/^#+/
,
''
);
// do not reload the page every time the language is changed
if
(
history
)
history
.
pushState
({},
''
,
'?'
+
language
+
'#'
+
hash
);
$
(
"#lang-selector a"
).
removeClass
(
'active'
);
$
(
"#lang-selector a[data-language-name='"
+
language
+
"']"
).
addClass
(
'active'
);
for
(
var
i
=
0
;
i
<
languages
.
length
;
i
++
)
{
...
...
@@ -48,25 +54,13 @@ under the License.
// no language selected, so use the default
activateLanguage
(
languages
[
0
]);
}
// if we click on a language tab, reload the page with that language in the URL
$
(
"#lang-selector a"
).
bind
(
"click"
,
function
()
{
window
.
location
.
replace
(
"?"
+
$
(
this
).
data
(
"language-name"
)
+
window
.
location
.
hash
);
return
false
;
});
}
// if we click on a language tab, activate that language
$
(
function
()
{
$
(
"#lang-selector a"
).
on
(
"click"
,
function
()
{
var
lang
=
$
(
this
).
data
(
"language-name"
);
var
hash
=
window
.
location
.
hash
;
if
(
hash
)
hash
=
hash
.
replace
(
/^#+/
,
''
);
// do not reload the page every time the language is changed
if
(
history
)
history
.
pushState
({},
''
,
'?'
+
lang
+
'#'
+
hash
);
activateLanguage
(
lang
);
var
language
=
$
(
this
).
data
(
"language-name"
);
activateLanguage
(
language
);
return
false
;
});
window
.
onpopstate
=
function
(
event
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment