Páginas (3):    1 2 3   
Gypaete   4 Sep, 2011, 4:39 am
#11
Lo que te pasa es que no te sale no? Pues muy fácil, abre el plugin y mira las variables que se necesita y las agregas y listo.

Y me refería a que no tiene ningún code jQuery.
papi   4 Sep, 2011, 3:25 pm
#12
(4 Sep, 2011, 4:39 am)Gypaete escribió: Lo que te pasa es que no te sale no? Pues muy fácil, abre el plugin y mira las variables que se necesita y las agregas y listo.

Y me refería a que no tiene ningún code jQuery.

Puews es que yo no se que variables puede necesitar Sad
papi   6 Sep, 2011, 3:34 am
#13
Bueno por si sirve, aqui dejo el fastquote.php
<?php
/*
	Plugin:		Fast Quote Plugin
	Version:	1.0
	Author:		Lukasz "LukasAMD" Tkacz 
	Date:		  30.06.2011
*/


if (!defined('IN_MYBB'))
{
	die('Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.');
}


// Add hooks
$plugins->add_hook('postbit','fastQuote::addButton');

      


// Stanard MyBB function with informations about plugin
function fastQuote_info()
{
	global $lang;

	$lang->load('fastQuote');

	return Array(
		'name' => $lang->fastQuoteName,
		'description' => $lang->fastQuoteDesc,
		'website' => 'http://lukasztkacz.com',
		'author' => 'Lukasz "LukasAMD" Tkacz',
		'authorsite' => 'http://lukasztkacz.com',
		'version' => '1.1',
		'guid' => '233a28d0a679315aa30cf168f84c3485',
		'compatibility' => '16*'
	);
}

// START - Standard MyBB installation functions
function fastQuote_install() 
{
  global $db, $lang;
  
	$lang->load('fastQuote');
 
	// Unistall plugin
	$db->delete_query('settinggroups', "name = 'fastQuote'");
	$db->delete_query('settings', "name = 'fastQuoteStatus'");
  $db->delete_query('settings', "name = 'fastQuoteImagePath'");
	$db->delete_query('settings', "name = 'fastQuoteFormName'");
  $db->delete_query('settings', "name = 'fastQuoteFieldName'");
  
  $result = $db->simple_select('settinggroups', 'MAX(disporder) AS max_disporder');
  $max_disporder = (int) $db->fetch_field($result, 'max_disporder');

	$settings_group = array(
		'gid'			=> 'NULL',
		'name'			=> 'fastQuote',
		'title'			=> $db->escape_string($lang->fastQuoteName),
		'description'	=> $db->escape_string($lang->fastQuoteGroupDesc),
		'disporder'		=> $max_disporder + 1,
		'isdefault'		=> '0'
	);
	$db->insert_query('settinggroups', $settings_group);
	$gid = (int) $db->insert_id();
 
	$setting = array(
		'sid'			=> 'NULL',
		'name'			=> 'fastQuoteStatus',
		'title'			=> $db->escape_string($lang->fastQuoteStatus),
		'description'	=> $db->escape_string($lang->fastQuoteStatusDesc),
		'optionscode'	=> 'onoff',
		'value'			=> '1',
		'disporder'		=> '1',
		'gid'			=> $gid
	);
	$db->insert_query('settings', $setting);
 
	$setting = array(
		'sid'			=> 'NULL',
		'name'			=> 'fastQuoteImagePath',
		'title'			=> $db->escape_string($lang->fastQuoteImagePath),
		'description'	=> $db->escape_string($lang->fastQuoteImagePathDesc),
		'optionscode'	=> 'text',
		'value'			=> 'images/postbit_quote_fast.gif',
		'disporder'		=> '2',
		'gid'			=> $gid
	);
	$db->insert_query('settings', $setting);
  
	$setting = array(
		'sid'			=> 'NULL',
		'name'			=> 'fastQuoteText',
		'title'			=> $db->escape_string($lang->fastQuoteText),
		'description'	=> $db->escape_string($lang->fastQuoteTextDesc),
		'optionscode'	=> 'text',
		'value'			=> $lang->fastQuoteTextDef,
		'disporder'		=> '3',
		'gid'			=> $gid
	);
	$db->insert_query('settings', $setting);
  
	$setting = array(
		'sid'			=> 'NULL',
		'name'			=> 'fastQuoteFormName',
		'title'			=> $db->escape_string($lang->fastQuoteFormName),
		'description'	=> $db->escape_string($lang->fastQuoteFormNameDesc),
		'optionscode'	=> 'text',
		'value'			=> 'quick_reply_form',
		'disporder'		=> '4',
		'gid'			=> $gid
	);
	$db->insert_query('settings', $setting);
      
	$setting = array(
		'sid'			=> 'NULL',
		'name'			=> 'fastQuoteFieldName',
		'title'			=> $db->escape_string($lang->fastQuoteFieldName),
		'description'	=> $db->escape_string($lang->fastQuoteFieldNameDesc),
		'optionscode'	=> 'text',
		'value'			=> 'message',
		'disporder'		=> '5',
		'gid'			=> $gid
	);
	$db->insert_query('settings', $setting);
      
  rebuildsettings(); 
}

function fastQuote_is_installed() 
{
  global $mybb;
  
  return (isset($mybb->settings['fastQuoteStatus']));
}

function fastQuote_uninstall() 
{
  global $db;

	$db->delete_query('settinggroups', "name = 'fastQuote'");
	$db->delete_query('settings', "name = 'fastQuoteStatus'");
  $db->delete_query('settings', "name = 'fastQuoteImagePath'");
  $db->delete_query('settings', "name = 'fastQuoteText'");
	$db->delete_query('settings', "name = 'fastQuoteFormName'");
  $db->delete_query('settings', "name = 'fastQuoteFieldName'");
  
  rebuildsettings();
}
// END - Standard MyBB installation functions

// START - Standard MyBB activation functions
function fastQuote_activate() 
{
	global $db;
  include MYBB_ROOT . '/inc/adminfunctions_templates.php';
  
  $showthreadChange = "<!-- start: FastQuote -->\n";
  $showthreadChange .= "<script type=\"text/javascript\" src=\"jscripts/fastQuote.js\"></script>\n";
  $showthreadChange .= "<script type=\"text/javascript\">\n";
  $showthreadChange .= 'var form_name = \'{$mybb->settings[\'fastQuoteFormName\']}\';' . "\n";
  $showthreadChange .= 'var text_name = \'{$mybb->settings[\'fastQuoteFieldName\']}\';' . "\n";
  $showthreadChange .= "</script>\n";
  $showthreadChange .= "<!-- end: FastQuote -->\n";
  $showthreadChange .= "</head>"; 
  
  find_replace_templatesets('showthread', '#<\/head>#', $showthreadChange);
  find_replace_templatesets('postbit', '#{\$post\[\'button_quote\'\]}#', '{$post[\'button_quote_fast\']}{$post[\'button_quote\']}');
  find_replace_templatesets('postbit_classic', '#{\$post\[\'button_quote\'\]}#', '{$post[\'button_quote_fast\']}{$post[\'button_quote\']}');
}

function fastQuote_deactivate() 
{
	global $db;
	include MYBB_ROOT . '/inc/adminfunctions_templates.php';

  find_replace_templatesets('showthread', "#<\!-- start: FastQuote -->.*<\!-- end: FastQuote -->\n#siU", '', 0);
  find_replace_templatesets('postbit', '#{\$post\[\'button_quote_fast\'\]}#', '', 0);
  find_replace_templatesets('postbit_classic', '#{\$post\[\'button_quote_fast\'\]}#', '', 0);
}
// END - Standard MyBB activation functions




// Fast Quote Plugin Class
class fastQuote
{
	/**
	 * Add fast quote button to post data
	 * 
	 * @return array
	 */ 
  public static function addButton($post)
  {
    global $mybb, $lang, $quickreply;
    
    $post['button_quote_fast'] = '';
    
    // MyBB code from showthread check all, so, we can use this fact      fastQuoteText
    $mybb->settings['fastQuoteStatus'] = (int) $mybb->settings['fastQuoteStatus'];
    if ($quickreply !== '' && $mybb->settings['fastQuoteStatus'])
    {
      $post['button_quote_fast'] .= '<a href="#message" onclick="addquote(' . $post['pid'] . ",'" . $post['username'] . "'";
      $post['button_quote_fast'] .= '); insert_text(\'\r\n\'); return false;" title="' . $mybb->settings['fastQuoteText'] . '">';  
      $post['button_quote_fast'] .= '<img src="' . $mybb->settings['fastQuoteImagePath'] . '" alt="' . $mybb->settings['fastQuoteText'] . '" /></a>';
    }

    return $post;
  } 
}
?>
y aqui el fastquote.js
/* Fast Quote Plugin javascript file */
/* All code from phpBB3 SEO Premod, based on GPLv2 License */ 
function initInsertions() 
{
	var doc;

	if (document.forms[form_name])
	{
		doc = document;
	}
	else 
	{
		doc = opener.document;
	}

	var textarea = doc.forms[form_name].elements[text_name];
	if (is_ie && typeof(baseHeight) != 'number')
	{	
		textarea.focus();
		baseHeight = doc.selection.createRange().duplicate().boundingHeight;

		if (!document.forms[form_name])
		{
			document.body.focus();
		}
	}
}

/**
* Insert text at position
*/
function insert_text(text, spaces, popup)
{
	var textarea;
	
	if (!popup) 
	{
		textarea = document.forms[form_name].elements[text_name];
	} 
	else 
	{
		textarea = opener.document.forms[form_name].elements[text_name];
	}
	if (spaces) 
	{
		text = ' ' + text + ' ';
	}
	
	if (!isNaN(textarea.selectionStart))
	{
		var sel_start = textarea.selectionStart;
		var sel_end = textarea.selectionEnd;

		mozWrap(textarea, text, '');
		textarea.selectionStart = sel_start + text.length;
		textarea.selectionEnd = sel_end + text.length;
	}	
	
	else if (textarea.createTextRange && textarea.caretPos)
	{
		if (baseHeight != textarea.caretPos.boundingHeight) 
		{
			textarea.focus();
			storeCaret(textarea);
		}		
		var caret_pos = textarea.caretPos;
		caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
		
	}
	else
	{
		textarea.value = textarea.value + text;
	}
	if (!popup) 
	{
		textarea.focus();
	} 	

}







// Startup variables
var imageTag = false;
var theSelection = false;
var bbcodeEnabled = true;

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));

function addquote(post_id, username, l_wrote)
{
	var message_name = 'message_' + post_id;
	var theSelection = '';
	var divarea = false;

	if (l_wrote === undefined)
	{
		// Backwards compatibility
		l_wrote = 'wrote';
	}

	if (document.all)
	{
		divarea = document.all[message_name];
	}
	else
	{
		divarea = document.getElementById(message_name);
	}

	// Get text selection - not only the post content :(
	if (window.getSelection)
	{
		theSelection = window.getSelection().toString();
	}
	else if (document.getSelection)
	{
		theSelection = document.getSelection();
	}
	else if (document.selection)
	{
		theSelection = document.selection.createRange().text;
	}

	if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
	{
		if (divarea.innerHTML)
		{
			theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
			theSelection = theSelection.replace(/<br\/>/ig, '\n');
			theSelection = theSelection.replace(/&lt\;/ig, '<');
			theSelection = theSelection.replace(/&gt\;/ig, '>');
			theSelection = theSelection.replace(/&amp\;/ig, '&');
			theSelection = theSelection.replace(/&nbsp\;/ig, ' ');
		}
		else if (document.all)
		{
			theSelection = divarea.innerText;
		}
		else if (divarea.textContent)
		{
			theSelection = divarea.textContent;
		}
		else if (divarea.firstChild.nodeValue)
		{
			theSelection = divarea.firstChild.nodeValue;
		}
	}

	if (theSelection)
	{
		if (bbcodeEnabled)
		{
			insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
		}
		else
		{
			insert_text(username + ' ' + l_wrote + ':' + '\n');
			var lines = split_lines(theSelection);
			for (i = 0; i < lines.length; i++)
			{
				insert_text('> ' + lines[i] + '\n');
			}
		}
	}

	return;
}


/**
* From http://www.massless.org/mozedit/
*/
function mozWrap(txtarea, open, close)
{
	var selLength = (typeof(txtarea.textLength) == 'undefined') ? txtarea.value.length : txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	var scrollTop = txtarea.scrollTop;

	if (selEnd == 1 || selEnd == 2) 
	{
		selEnd = selLength;
	}

	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd);
	var s3 = (txtarea.value).substring(selEnd, selLength);

	txtarea.value = s1 + open + s2 + close + s3;
	txtarea.selectionStart = selStart + open.length;
	txtarea.selectionEnd = selEnd + open.length;
	txtarea.focus();
	txtarea.scrollTop = scrollTop;

	return;
}
nentab   6 Sep, 2011, 3:50 am
#14
No estoy seguro, pero creo que hace los siguientes cambios de plantillas:

showthread > Añade esto antes del </head>:

<!-- start: FastQuote -->
<script type="text/javascript" src=\"jscripts/fastQuote.js"></script>
<script type="text/javascript">
var form_name = '{$mybb->settings['fastQuoteFormName']}'
var text_name = '{$mybb->settings['fastQuoteFieldName']}'
</script>
<!-- end: FastQuote -->

postbit y postbit_classic > Añade esto antes del {$post['button_quote']}:

{$post['button_quote_fast']}
Última modificación: 6 Sep, 2011, 3:52 am por Cluster.
papi   6 Sep, 2011, 12:13 pm
#15
no no funciona. Es mas, el codigo
{$post['button_quote_fast']}
estaba ya incluido en postbit y posbit_classic
Me pregunot si no sera a causa de la inclusion del editor en la respuesta rápida. Porque antes de eso si que funcionaban bien los dos plugins Sad
Última modificación: 6 Sep, 2011, 12:14 pm por TechMiX.
Omar G.   6 Sep, 2011, 12:22 pm
#16
El codigo que paso Abdon, debes quitarle la /:
<!-- start: FastQuote -->
 <script type="text/javascript" src="jscripts/fastQuote.js"></script>
 <script type="text/javascript">
 var form_name = '{$mybb->settings['fastQuoteFormName']}'
 var text_name = '{$mybb->settings['fastQuoteFieldName']}'
 </script>
 <!-- end: FastQuote -->

Envía un DM o MP si te interesa patrocinar alguna actualización o complemento a alguno de mis plugins.

[Imagen: signature.png]

Discord omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
papi   6 Sep, 2011, 1:50 pm
#17
NO entiendo. Yo veo los dos códigos exactamente iguales ¿Cuál es el cambio que propones?
Omar G.   6 Sep, 2011, 2:07 pm
#18
^Lo intentaste como mínimo?

Envía un DM o MP si te interesa patrocinar alguna actualización o complemento a alguno de mis plugins.

[Imagen: signature.png]

Discord omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
nentab   6 Sep, 2011, 4:19 pm
#19
Tiene razón JustU, papi. A mi se me coló borrar una / antes de "jscripts.

Prueba y nos cuentas.
papi   7 Sep, 2011, 2:27 am
#20
listo, llevaba razon JustU perdon por dudar pero aprecia el codigo exactamente igual Mas 1 rep Wink
Por cierto no me explico por que funciona en chameleon y no en Sky-cotton :S
Última modificación: 7 Sep, 2011, 2:29 am por TechMiX.
Páginas (3):    1 2 3   
  
Powered By MyBB, © 2002-2025 MyBB Group.
Made with by Curves UI.