Přihlásit se

Joomla 5.1.0 a Joomla 4.4.4 (17 dub 2024)

Dnes byla uvolněna nová verze Joomla 5.1.0, společně s Joomla 4.4.4. Tato verze přináší spoustu nových funkcí, vylepšení v oblasti bezpečnosti a kódu a díky těmto vylepšením i vyšší rychlost.

Cobalt 7 - nezobrazuje se výpis kategorie v IE 8

24. led 2013 16:58 #102806
Odpověď od Philip Jay Fry
Začátečník
Dobrý vtip od Microsoftu.

24. led 2013 19:45 #102817
Odpověď od CrocodilusCZ
Zkušený uživatel
opět jsem našel drobek informací, ale s tímhle už neumím naložit.



Neporadil by někdo, jestli z toho teda někdo něco rozumného vyčte? Třeba jak donutit ten javascript načítat se až po zobrazení stránek, nebo co se to s tím dá dělat?

Díky

24. led 2013 21:12 #102824
Odpověď od Cony
Moderátor
Jak jsem psal, spuštění skriptu až po načtení kompletního DOM stromu se zajistí tímto
Code:
window.addEvent('domready',function() { // zde původní skript });
Případně pro spuštění skriptu až při načtení kompletního dokumentu (včetně obrázků apod.)
Code:
window.addEvent('load',function() { // zde původní skript });
Předpokladem je že máte načtené Mootools, ale ty nejspíš budou.

24. led 2013 21:19 #102825
Odpověď od CrocodilusCZ
Zkušený uživatel
Jestli to chápu správně tak nahradit
Code:
window.addEvent('domready',function() {
tímto
Code:
window.addEvent('load',function() {
?

Moc nechápu, kam to jinam nacpat a už mi z toho jde hlava kolem.....

24. led 2013 21:51 #102830
Odpověď od Cony
Moderátor
Nene, an jedna z těch možností tam momentálne neni, zkusil bych nejprve tu první. Někde v šabloně bude kód, přidávající tento script (vypsal jsem jen začátek a konec)
Code:
var t69ff3 = new TextboxList('tags', { .. t69ff3.plugins['autocomplete'].setValues(r69ff3)
Asi nebude takto jednoduše zapsaný, bude to nějaká kombinace s PHP, ale někde tam bude.
tak celý tento kód upravit tak, aby vypadal takto
Code:
window.addEvent('domready', function() { var t69ff3 = new TextboxList('tags', { .. t69ff3.plugins['autocomplete'].setValues(r69ff3); });
přidán jeden řádek a začátku a jeden na konci.

24. led 2013 22:01 #102834
Odpověď od CrocodilusCZ
Zkušený uživatel
to bude asi tohle:
Code:
<?php /** * Cobalt by MintJoomla * a component for Joomla! 1.7 - 2.5 CMS (http://www.joomla.org) * Author Website: http://www.mintjoomla.com/ * @copyright Copyright (C) 2012 MintJoomla (http://www.mintjoomla.com). All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ defined('_JEXEC') or die(); class JHTMLMrelements { /** * * Enter description here ... * @param unknown_type $name * @param unknown_type $files * @param array $options width, height, max_size, file_formats, max_count, , */ public static function mooupload($name = 'filecontrol', $files = NULL, $options = array(), $field_id = 0) { $doc = JFactory::getDocument(); $doc->addScript(JURI::root().'media/mint/js/mooupload/MooUpload.js'); $doc->addStyleSheet(JURI::root().'media/mint/js/mooupload/style.css'); $tempname = substr(md5(time().rand(1, 1000000)), 0, 5); $params = new JRegistry(); $params->loadArray($options); $record_id = JRequest::getInt('id', 0); $exts = explode(',', $params->get('file_formats', 'zip, jpg, png, jpeg, gif, txt, md, bmp')); foreach ($exts as &$ext) { $ext = trim($ext); } $session = JFactory::getSession(); $session->set('width', $params->get('width', 0), md5($name)); $session->set('height', $params->get('height', 0), md5($name)); $session->set('max_size', $params->get('max_size', 2097152), md5($name)); $session->set('file_formats', $exts, md5($name)); if(!empty($files) && is_array($files)) { $files = json_encode($files); } else { $files = 0; } $out[] = '<div id="el'.$tempname.'"><dl id="system-message"><dt class="error">Error</dt><dd class="error message"><ul id="errorslist'.$tempname.'"></ul></dd></dl></div>'; $out[] = " <script type=\"text/javascript\"> $('el{$tempname}').hide(); window.addEvent('load', function() { var myUpload = new MooUpload('{$tempname}', { action: '".JURI::root()."index.php?option=com_cobalt&task=files.upload&no_html=1&section_id=".JRequest::getInt('section_id')."&record_id=".JRequest::getInt('id')."&type_id=".JRequest::getInt('type_id')."&field_id={$field_id}&key=".md5($name)."', action_remove_file: '".JURI::root()."index.php?option=com_cobalt&task=files.uploadremove&no_html=1', method: '".$params->get('method', 'auto')."', tempname: '{$tempname}', files:".$files.", formname:'".$name."[]', field_id:".$field_id.", record_id:".$record_id.", maxfilesize: ".$params->get('max_size', 2097152).", exts: ['".implode("','", $exts)."'], maxFilesCount: ".$params->get('max_count', 1).", canDelete: ".$params->get('can_delete', 1).", allowEditTitle: ".$params->get('allow_edit_title', 1).", allowAddDescr: ".$params->get('allow_add_descr', 1).", flash: { movie: '".JURI::root()."media/mint/js/mooupload/Moo.Uploader.swf' }, texts: { error : '".JText::_('CERROR')."', file : '".JText::_('CFILE')."', filesize : '".JText::_('CFILESIZE')."', filetype : '".JText::_('CFILETYPE')."', nohtml5 : '".JText::_('CNOHTMLSUPPORT')."', noflash : '".JText::_('CINSTALLFLASH')."', sel : '".JText::_('CACT')."', selectfile : '".JText::_('CADDFILE')."', status : '".JText::_('CSTATUS')."', startupload: '".JText::_('CCTARTUPLOAD')."', uploaded : '".JText::_('CUPLOADED')."', sure : '".JText::_('CSURE')."', edit_descr : '".JText::_('CEDITDESCR')."', edit_title : '".JText::_('CEDITTITLE')."' }, ".( $params->get('callback') ? " onFileUpload:function(fileindex, response){ ".$params->get('callback')."(fileindex, response); }," : NULL)." onFileDelete: function(error, filename){ if(error == '1016') { msg = '".JText::sprintf('CERR_FILEDOSENTDELETED', "' + filename", array('jsSafe' => true))."; } if(error == '1017') { msg = '".JText::sprintf('CERR_FILEDOSENTEXIST', "' + filename", array('jsSafe' => true))."; } if(error) { var li = new Element('li', {text:msg}); $('errorslist'+this.options.tempname).grab(li); $('el'+this.options.tempname).show().slide('in'); } }, onSelectError: function(error, filename, filesize){ var msg = error; if(error == '1012') { msg = '".JText::sprintf('CERR_FILEUPLOADLIMITREACHED', $params->get('max_count', 1))."'; } if(error == '1013') { msg = '".JText::sprintf('CERR_EXTENSIONNOTALLOWED', " + filename + ", array('jsSafe' => true))."'; } if(error == '1014') { msg = '".JText::sprintf('CERR_UPLOADEDFILESIZESMALLER', "' + filename + '", array('jsSafe' => true))."'; } if(error == '1015') { msg = '".JText::sprintf('CERR_UPLOADEDFILESIZEBIGGER', "' + filename + '", array('jsSafe' => true))."'; } var li = new Element('li', {text:msg}); $('errorslist'+this.options.tempname).grab(li); $('el'+this.options.tempname).show().slide('in'); } }); }); </script>"; $out[] = '<div id="'.$tempname.'" class="upload-element"></div>'; if($exts) { $out[] = '<br/><span class="small">'.JText::_('CER_ONLYFORMATS').': <b>'.implode("</b>, <b>", $exts).'</b></span>'; } $out[] = '<br/><span class="small">'.JText::_('CNSG_MAXSIZEPERFILE').': <b>'.HTMLFormatHelper::formatSize($params->get('max_size', 2097152)).'</b></span>'; return implode("\n", $out); } public static function autocompleteitem($html, $id = NULL, $render = NULL) { $o = new stdClass(); $o->id = ($id ? $id : strip_tags($html)); $o->html = $html; $o->plain = strip_tags($html); $o->render = ($render ? $render : $html); return $o; } public static function listautocomplete($name, $id, $default = array(), $list = array(), $options = array()) { $params = new JRegistry(); $params->loadArray($options); settype($default, 'array'); if($params->get('only_values', 0) == 1 && !$list && !$params->get('ajax_url')) { return '<input type="hidden" name="'.$name.'" id="'.$id.'" value="" />'; } $doc = JFactory::getDocument(); $doc->addStyleSheet(JURI::root().'media/mint/js/autocomplete/style.css'); $doc->addScript(JURI::root().'media/mint/js/GrowingInput.js'); $doc->addScript(JURI::root().'media/mint/js/autocomplete/listautocomplete.textbox.js'); $doc->addScript(JURI::root().'media/mint/js/autocomplete/listautocomplete.complete.js'); $el = $add = $skip = $a = array(); $script = NULL; $patern = '["%s", "%s", "%s", "%s"]'; foreach ($default AS &$def) { if(!is_object($def)) { $def = self::autocompleteitem($def); } if(!$def->id) continue; $add[] = sprintf('add("%s", "%s", "%s")', str_replace('"', '\\"', stripslashes($def->plain)), str_replace('"', '\\"', stripslashes($def->id)), str_replace('"', '\\"', stripslashes($def->html))); $skip[] = $def->id; } foreach ($list as &$item) { if(!is_object($item)) { $item = self::autocompleteitem($item); } if(in_array($item->id, $skip)) continue; if(!trim($item->id)) continue; $el[] = sprintf($patern, str_replace('"', '\\"', stripslashes($item->id)), str_replace('"', '\\"', stripslashes($item->plain)), str_replace('"', '\\"', stripslashes($item->html)), str_replace('"', '\\"', stripslashes($item->render))); } $a[] = "\nplaceholder: '".JText::_('CTYPETOSUGGEST')."'"; $a[] = "\nremote:{ emptyResultPlaceholder:'" . JText::_('CNOSUGGEST') . "', loadPlaceholder:'" . JText::_('CPLSWAIT') . "'}"; $a[] = "\nwidth: '" . $params->get('min_width', 300) . "'"; $a[] = "\nminLength: " . $params->get('min_length', 1); $a[] = "\nmaxResults: " . $params->get('max_result', 10); if($params->get('only_values', 0) == 1) { $a[] = "\nonlyFromValues: 1"; } if($params->get('case_sensitive', 0)) { $a[] = "\ninsensitive: false"; } if($params->get('highlight', 0) == 0) { $a[] = "\nhighlight: false"; } $additional[] = "\nplugins: {autocomplete: {".implode(',', $a)."}}"; if($params->get('coma_separate', 0))// && !count($el)) { $additional[] = "\nbitsOptions : { editable : {addKeys:188}}"; } if($params->get('max_items', 0)) { $additional[] = "\nmax : ".$params->get('max_items', 0); } if($params->get('unique', 0)) { $additional[] = "\nunique: true "; } if($params->get('separateby', 0)) { $additional[] = "\n".'decode: function(o) { return o.split(\''.$params->get('separateby').'\'); }, encode: function(o) { return o.map(function(v) { v = ($chk(v[0]) ? v[0] : v[1]); return $chk(v) ? v : null; }).clean().join(\''.$params->get('separateby').'\'); }'; } $options = '{'.implode(',', $additional).'}'; $uniq = substr(md5(time().'-'.rand(0, 1000)), 0, 5); $html[] = '<input type="text" name="'.$name.'" id="'.$id.'" value="" />'; $html[] = "<script type=\"text/javascript\">"; $html[] = "var t{$uniq} = new TextboxList('{$id}', {$options});\n";// if($add) { $html[] = "t{$uniq}.".implode(".", $add).";\n"; } if($el) { $html[] = "var r{$uniq} = [".implode(",", $el)."];\n"; $html[] = "t{$uniq}.plugins['autocomplete'].setValues(r{$uniq});\n"; } if ($params->get('ajax_url')) { $html[] = "t{$uniq}.container.addClass('textboxlist-loading');\n"; $html[] = "new Request.JSON( {url: '".$params->get('ajax_url')."', data:{".$params->get('ajax_data')."}, onSuccess: function(r) { if(!r.success) { alert(r.error); return; } if(r.result) { t{$uniq}.container.removeClass('textboxlist-loading'); t{$uniq}.plugins['autocomplete'].setValues(r.result); } }}).send();"; } $html[] = "</script>\n"; $html[] = '<style type="text/css"> .textboxlist { max-width: '.$params->get('max_width', 400).'px !important; min-width: '.$params->get('min_width', 300).'px !important; } </style>'; return implode("\n", $html); } }

ale když část
Code:
$html[] = "var t{$uniq} = new TextboxList('{$id}', {$options});\n";// if($add) { $html[] = "t{$uniq}.".implode(".", $add).";\n"; } if($el) { $html[] = "var r{$uniq} = [".implode(",", $el)."];\n"; $html[] = "t{$uniq}.plugins['autocomplete'].setValues(r{$uniq});\n";

uzavřu takhle:
Code:
window.addEvent('domready', function() { $options = '{'.implode(',', $additional).'}'; $uniq = substr(md5(time().'-'.rand(0, 1000)), 0, 5); $html[] = '<input type="text" name="'.$name.'" id="'.$id.'" value="" />'; $html[] = "<script type=\"text/javascript\">"; $html[] = "var t{$uniq} = new TextboxList('{$id}', {$options});\n";// if($add) { $html[] = "t{$uniq}.".implode(".", $add).";\n"; } if($el) { $html[] = "var r{$uniq} = [".implode(",", $el)."];\n"; $html[] = "t{$uniq}.plugins['autocomplete'].setValues(r{$uniq});\n"; } });

tak už to nenajede...

Powered by Fórum