Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
radiopanik
panikweb
Commits
93eebcdd
Commit
93eebcdd
authored
Sep 12, 2013
by
fred
Browse files
make it possible to set initially enabled toggles with a ?q parameter
parent
7eb23040
Changes
1
Hide whitespace changes
Inline
Side-by-side
panikweb_templates/static/js/specifics.js
View file @
93eebcdd
var
urlParams
;
(
window
.
onpopstate
=
function
()
{
var
match
,
pl
=
/
\+
/g
,
// Regex for replacing addition symbol with a space
search
=
/
([^
&=
]
+
)
=
?([^
&
]
*
)
/g
,
decode
=
function
(
s
)
{
return
decodeURIComponent
(
s
.
replace
(
pl
,
"
"
));
},
query
=
window
.
location
.
search
.
substring
(
1
);
urlParams
=
{};
while
(
match
=
search
.
exec
(
query
))
urlParams
[
decode
(
match
[
1
])]
=
decode
(
match
[
2
]);
})();
$
(
function
()
{
doLog
=
function
(
aTextToLog
,
type
){
...
...
@@ -335,6 +348,17 @@ $(function() {
$
(
'
[data-toggle].icon-check-empty
'
).
each
(
function
(){
$
(
this
).
trigger
(
'
uncheck
'
);
});
initial_enabled_toggles
=
{};
if
(
typeof
(
urlParams
.
q
)
==
'
string
'
)
{
urlParams
.
q
.
split
(
'
|
'
).
forEach
(
function
(
a
)
{
initial_enabled_toggles
[
a
]
=
1
;
})
}
$
(
'
[data-toggle]
'
).
each
(
function
()
{
if
(
$
(
this
).
data
(
'
toggle
'
).
substring
(
1
)
in
initial_enabled_toggles
)
{
$
(
this
).
trigger
(
'
click
'
);
}
});
if
(
$
(
'
input#id_q
'
).
val
()
==
''
)
{
$
(
'
input#id_q
'
).
focus
();
}
...
...
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