| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
PDD_20
Joined: 23 May 2008 Posts: 46 Location: Spain
|
Posted: Mon Aug 25, 2008 12:31 pm Post subject: External Javascript |
|
|
Hi, I think what I should put this code in a external javascript.
¿Can I put them or there are problems?
Thanks.
| Code: | <script type="text/javascript">
// <![CDATA[
var jump_page = 'Introduzca el número de página al que desea ir:';
var on_page = '';
var per_page = '';
var base_url = '';
var style_cookie = 'phpBBstyle';
var onload_functions = new Array();
var onunload_functions = new Array();
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
var seo_delim_start = '-';
var seo_static_pagination = 'page';
var seo_ext_pagination = '.html';
// www.phpBB-SEO.com SEO TOOLKIT END
if (0)
{
var url = './ucp.php?i=pm&mode=popup';
window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
}
/**
* Find a member
*/
function find_username(url)
{
popup(url, 760, 570, '_usersearch');
return false;
}
/**
* New function for handling multiple calls to window.onload and window.unload by pentapenguin
*/
window.onload = function()
{
for (var i = 0; i < onload_functions.length; i++)
{
eval(onload_functions[i]);
}
}
window.onunload = function()
{
for (var i = 0; i < onunload_functions.length; i++)
{
eval(onunload_functions[i]);
}
}
// ]]>
</script>
|
|
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15414
|
Posted: Wed Aug 27, 2008 2:11 pm Post subject: Re: External Javascript |
|
|
There is no real point to do so, this is from prosilver and this theme already separated most of the js in from the templates (not the same with subsilver2).
You could put some of this code in a separate file too, but not all since many of it need to be kept in templates because variables will be passed there, here the source in the template :
| Code: | <script type="text/javascript">
// <![CDATA[
var jump_page = '{LA_JUMP_PAGE}:';
var on_page = '{ON_PAGE}';
var per_page = '{PER_PAGE}';
var base_url = '{A_BASE_URL}';
var style_cookie = 'phpBBstyle';
var onload_functions = new Array();
var onunload_functions = new Array();
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
var seo_delim_start = '{SEO_START_DELIM}';
var seo_static_pagination = '{SEO_SATIC_PAGE}';
var seo_ext_pagination = '{SEO_EXT_PAGE}';
// www.phpBB-SEO.com SEO TOOLKIT END
<!-- IF S_USER_PM_POPUP -->
if ({S_NEW_PM})
{
var url = '{UA_POPUP_PM}';
window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
}
<!-- ENDIF -->
/**
* Find a member
*/
function find_username(url)
{
popup(url, 760, 570, '_usersearch');
return false;
}
/**
* New function for handling multiple calls to window.onload and window.unload by pentapenguin
*/
window.onload = function()
{
for (var i = 0; i < onload_functions.length; i++)
{
eval(onload_functions[i]);
}
}
window.onunload = function()
{
for (var i = 0; i < onunload_functions.length; i++)
{
eval(onunload_functions[i]);
}
}
// ]]>
</script> |
Only the code after :
| Code: | /**
* Find a member
*/ |
could be moved, but it's not much, and the window.onload / onunload function will have to be set before other functions, which is probably why they where kept in the header in the first place.
I'd personally leave this as is.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |