Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
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
outils
question2answer
Commits
0d976995
Commit
0d976995
authored
Oct 28, 2015
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up JavaScript for window.load
Use jQuery to simplify.
parent
3011b268
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
28 deletions
+19
-28
qa-page.php
qa-include/qa-page.php
+19
-28
No files found.
qa-include/qa-page.php
View file @
0d976995
...
@@ -324,34 +324,6 @@
...
@@ -324,34 +324,6 @@
$script
=
array_merge
(
$script
,
$scriptlines
);
$script
=
array_merge
(
$script
,
$scriptlines
);
}
}
if
(
isset
(
$qa_content
[
'focusid'
]))
$qa_content
[
'script_onloads'
][]
=
array
(
"var elem = document.getElementById("
.
qa_js
(
$qa_content
[
'focusid'
])
.
");"
,
"if (elem) {"
,
"
\t
elem.select();"
,
"
\t
elem.focus();"
,
"}"
,
);
if
(
isset
(
$qa_content
[
'script_onloads'
]))
{
array_push
(
$script
,
''
,
'var qa_oldonload = window.onload;'
,
'window.onload = function() {'
,
"
\t
if (typeof qa_oldonload == 'function')"
,
"
\t\t
qa_oldonload();"
);
foreach
(
$qa_content
[
'script_onloads'
]
as
$scriptonload
)
{
$script
[]
=
"
\t
"
;
foreach
((
array
)
$scriptonload
as
$scriptline
)
$script
[]
=
"
\t
"
.
$scriptline
;
}
$script
[]
=
'};'
;
}
$script
[]
=
'</script>'
;
$script
[]
=
'</script>'
;
if
(
isset
(
$qa_content
[
'script_rel'
]))
{
if
(
isset
(
$qa_content
[
'script_rel'
]))
{
...
@@ -366,6 +338,25 @@
...
@@ -366,6 +338,25 @@
$script
[]
=
'<script src="'
.
qa_html
(
$script_src
)
.
'"></script>'
;
$script
[]
=
'<script src="'
.
qa_html
(
$script_src
)
.
'"></script>'
;
}
}
if
(
isset
(
$qa_content
[
'focusid'
]))
$qa_content
[
'script_onloads'
][]
=
array
(
'jQuery('
.
qa_js
(
'#'
.
$qa_content
[
'focusid'
])
.
').focus();'
,
);
// JS onloads must come after jQuery is loaded
$script
[]
=
'<script>'
;
if
(
isset
(
$qa_content
[
'script_onloads'
]))
{
$script
[]
=
'jQuery(window).load(function() {'
;
foreach
(
$qa_content
[
'script_onloads'
]
as
$scriptonload
)
{
foreach
((
array
)
$scriptonload
as
$scriptline
)
$script
[]
=
"
\t
"
.
$scriptline
;
}
$script
[]
=
'});'
;
}
$script
[]
=
'</script>'
;
$qa_content
[
'script'
]
=
$script
;
$qa_content
[
'script'
]
=
$script
;
// Load the appropriate theme class and output the page
// Load the appropriate theme class and output the page
...
...
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