mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-28 20:45:00 +03:00
Spoilers
This commit is contained in:
parent
50d6e96312
commit
1e5e2cd98a
41
application/classes/modules/ifhub/Ifhub.class.php
Normal file
41
application/classes/modules/ifhub/Ifhub.class.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Модуль для функций Ифхаба
|
||||||
|
*
|
||||||
|
* @license GPLv2
|
||||||
|
* @package application.modules.ifhub
|
||||||
|
* @author Alexander Yakovlev
|
||||||
|
*/
|
||||||
|
class ModuleIfhub extends Module
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Инициализация
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function Init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Обработка тега spoiler в тексте
|
||||||
|
* <pre>
|
||||||
|
* <spoiler title="Заголовок">Текст спойлера</spoiler>
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param string $sTag Тег на ктором сработал колбэк
|
||||||
|
* @param array $aParams Список параметров тега
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function CallbackParserTagSpoiler($sTag, $aParams, $sText)
|
||||||
|
{
|
||||||
|
$sTitle = "Спойлер";
|
||||||
|
if (isset($aParams['title'])) {
|
||||||
|
$sTitle = $aParams['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<div class="spoiler">'.
|
||||||
|
'<b class="spoiler-title">'.$sTitle.'</b>'.
|
||||||
|
'<div class="spoiler-body">'.$sText.'</div>'.
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ return array(
|
||||||
'cfgAllowTags' => array(
|
'cfgAllowTags' => array(
|
||||||
// вызов метода с параметрами
|
// вызов метода с параметрами
|
||||||
array(
|
array(
|
||||||
array('ls', 'gallery'),
|
array('ls', 'gallery', 'spoiler'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Коротие теги типа
|
// Коротие теги типа
|
||||||
|
@ -56,6 +56,10 @@ return array(
|
||||||
'a',
|
'a',
|
||||||
array('data-rel' => '#text', 'class' => array('js-lbx'))
|
array('data-rel' => '#text', 'class' => array('js-lbx'))
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'spoiler',
|
||||||
|
array('title' => '#text')
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'cfgSetTagCallbackFull' => array(
|
'cfgSetTagCallbackFull' => array(
|
||||||
array(
|
array(
|
||||||
|
@ -66,6 +70,10 @@ return array(
|
||||||
'gallery',
|
'gallery',
|
||||||
array('_this_', 'Media_CallbackParserTagGallery'),
|
array('_this_', 'Media_CallbackParserTagGallery'),
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'spoiler',
|
||||||
|
array('_this_', 'Ifhub_CallbackParserTagSpoiler'),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*-------------------------------------------------------
|
|
||||||
*
|
|
||||||
* LiveStreet Engine Social Networking
|
|
||||||
* Copyright © 2008 Mzhelskiy Maxim
|
|
||||||
*
|
|
||||||
*--------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Official site: www.livestreet.ru
|
|
||||||
* Contact e-mail: rus.engine@gmail.com
|
|
||||||
*
|
|
||||||
* GNU General Public License, version 2:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
*
|
|
||||||
*---------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Plugin Spoiler
|
|
||||||
* Shpinev Konstantin
|
|
||||||
* Contact e-mail: thedoublekey@gmail.com
|
|
||||||
*
|
|
||||||
*---------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Spoiler :: Plugin
|
|
||||||
* Modified by fedorov mich © 2014
|
|
||||||
* [ LS :: 1.0.3 | Habra Style ]
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!class_exists('Plugin')) {
|
|
||||||
die('Hacking attemp!');
|
|
||||||
}
|
|
||||||
|
|
||||||
class PluginBspoiler extends Plugin {
|
|
||||||
protected $sTemplatesUrl = "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Делегаты
|
|
||||||
*
|
|
||||||
* @var unknown_type
|
|
||||||
*/
|
|
||||||
protected $aInherits = array(
|
|
||||||
'module' => array('ModuleText' => '_ModuleBspoiler')
|
|
||||||
);
|
|
||||||
|
|
||||||
// Активация плагина
|
|
||||||
public function Activate() {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Деактивация плагина
|
|
||||||
public function Deactivate() {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Инициализация плагина
|
|
||||||
*
|
|
||||||
* (non-PHPdoc)
|
|
||||||
* @see engine/classes/Plugin#Init()
|
|
||||||
*/
|
|
||||||
public function Init()
|
|
||||||
{
|
|
||||||
$sTemplatesUrl = Plugin::GetTemplatePath('PluginBspoiler');
|
|
||||||
|
|
||||||
// Добавление своего CSS и JS
|
|
||||||
$this->Viewer_AppendStyle($sTemplatesUrl."/css/style.css");
|
|
||||||
$this->Viewer_AppendScript($sTemplatesUrl."/js/bspoiler.js");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,8 +0,0 @@
|
||||||
---Плагин спойлер---
|
|
||||||
|
|
||||||
Описание настройки: http://livestreet.ru/blog/17229.html
|
|
||||||
|
|
||||||
Первоначальный автор - kks.
|
|
||||||
Адаптировал для 1.0.3 - http://livestreet.ru/profile/dex-/
|
|
||||||
Выложил в каталог - testerok, gs.dafter.ru
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
Order Deny,Allow
|
|
||||||
Deny from all
|
|
|
@ -1,64 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*-------------------------------------------------------
|
|
||||||
*
|
|
||||||
* LiveStreet Engine Social Networking
|
|
||||||
* Copyright © 2008 Mzhelskiy Maxim
|
|
||||||
*
|
|
||||||
*--------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Official site: www.livestreet.ru
|
|
||||||
* Contact e-mail: rus.engine@gmail.com
|
|
||||||
*
|
|
||||||
* GNU General Public License, version 2:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
*
|
|
||||||
*---------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Plugin Spoiler
|
|
||||||
* Shpinev Konstantin
|
|
||||||
* Contact e-mail: thedoublekey@gmail.com
|
|
||||||
*
|
|
||||||
*---------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Spoiler :: Plugin
|
|
||||||
* Modified by fedorov mich © 2014
|
|
||||||
* [ LS :: 1.0.3 | Habra Style ]
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
class PluginBspoiler_ModuleBspoiler extends ModuleText
|
|
||||||
{
|
|
||||||
protected function JevixConfig()
|
|
||||||
{
|
|
||||||
parent::JevixConfig();
|
|
||||||
|
|
||||||
$aTags = array_keys($this->oJevix->tagsRules);
|
|
||||||
$aTags[] = 'spoiler';
|
|
||||||
$this->oJevix->cfgAllowTags($aTags);
|
|
||||||
$this->oJevix->cfgAllowTagParams('spoiler', array('title'));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function SpoilerParser($sText)
|
|
||||||
{
|
|
||||||
$aMatches = array();
|
|
||||||
while (preg_match('/<spoiler title="(.+?)">/', $sText, $aMatches) !== false && count($aMatches) > 1) {
|
|
||||||
$sTitle = $aMatches[1];
|
|
||||||
$sText = str_replace("<spoiler title=\"$sTitle\">",
|
|
||||||
'<div><b class="spoiler-title">'.$sTitle.'</b><div class="spoiler-body">',
|
|
||||||
$sText);
|
|
||||||
$sText = str_replace("</spoiler>", '</div></div>', $sText);
|
|
||||||
}
|
|
||||||
return $sText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function Parser($sText)
|
|
||||||
{
|
|
||||||
$sResult = parent::Parser($sText);
|
|
||||||
$sResult = $this->SpoilerParser($sResult);
|
|
||||||
echo $sResult;die;
|
|
||||||
return $sResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,2 +0,0 @@
|
||||||
Order Deny,Allow
|
|
||||||
Deny from all
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*-------------------------------------------------------
|
|
||||||
*
|
|
||||||
* LiveStreet Engine Social Networking
|
|
||||||
* Copyright © 2008 Mzhelskiy Maxim
|
|
||||||
*
|
|
||||||
*--------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Official site: www.livestreet.ru
|
|
||||||
* Contact e-mail: rus.engine@gmail.com
|
|
||||||
*
|
|
||||||
* GNU General Public License, version 2:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
*
|
|
||||||
*---------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Plugin Spoiler
|
|
||||||
* Shpinev Konstantin
|
|
||||||
* Contact e-mail: thedoublekey@gmail.com
|
|
||||||
*
|
|
||||||
*---------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Spoiler :: Plugin
|
|
||||||
* Modified by fedorov mich © 2014
|
|
||||||
* [ LS :: 1.0.3 | Habra Style ]
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$config = array();
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<plugin>
|
|
||||||
<name>
|
|
||||||
<lang name="default">Bspoiler Plugin (rewrote 1.0.3)</lang>
|
|
||||||
<lang name="russian">Плагин Bspoiler (переделан под 1.0.3)</lang>
|
|
||||||
</name>
|
|
||||||
<author>
|
|
||||||
<lang name="default">kks (rewrote dex-)</lang>
|
|
||||||
<lang name="russian">kks (переделал dex-, выложил testerok)</lang>
|
|
||||||
</author>
|
|
||||||
<homepage>http://ls.ksotik.ru/</homepage>
|
|
||||||
<version>1.1.0</version>
|
|
||||||
<requires>
|
|
||||||
<livestreet>2.0.*</livestreet>
|
|
||||||
<plugins>
|
|
||||||
</plugins>
|
|
||||||
</requires>
|
|
||||||
<description>
|
|
||||||
<lang name="default">Spoiler tag support.</lang>
|
|
||||||
<lang name="russian">Плагин, добавляющий поддержку тега spoiler в топики и страницы.</lang>
|
|
||||||
</description>
|
|
||||||
</plugin>
|
|
|
@ -1,5 +0,0 @@
|
||||||
Options -Indexes
|
|
||||||
<Files ~ "\.tpl$">
|
|
||||||
Order allow,deny
|
|
||||||
Deny from all
|
|
||||||
</Files>
|
|
|
@ -1,10 +0,0 @@
|
||||||
/**
|
|
||||||
* Spoiler :: CSS
|
|
||||||
* Modified by fedorov mich © 2014
|
|
||||||
* [ LS :: 1.0.3 | Habra Style ]
|
|
||||||
*/
|
|
||||||
.spoiler-title { color: #6da3bd; border-bottom: 1px dashed; font-weight: normal; cursor: pointer; }
|
|
||||||
.spoiler-title:hover { color: #4d7285; }
|
|
||||||
.spoiler-body { display: none; padding: 10px; border: 1px solid #eee; background: #f9f9f9; margin-top: 10px; overflow: hidden; }
|
|
||||||
.spoiler-title:before { float: left; content: " "; width: 16px; height: 16px; margin-top: 2px; display: block; border: 0px solid red; background: url(../images/spoiler.icon.png) no-repeat left top; }
|
|
||||||
.spoiler-title.open:before { background: url(../images/spoiler.icon.png) no-repeat left bottom; }
|
|
Binary file not shown.
Before Width: | Height: | Size: 1,022 B |
|
@ -1,12 +0,0 @@
|
||||||
/**
|
|
||||||
* Spoiler :: jQuery
|
|
||||||
* Modified by fedorov mich © 2014
|
|
||||||
* [ LS :: 1.0.3 | Habra Style ]
|
|
||||||
*/
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('.spoiler-title').on('click touchstart', function(){
|
|
||||||
$(this).toggleClass('open');
|
|
||||||
$(this).parent().children('div.spoiler-body').toggle('normal');
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in a new issue