Skip to content

Instantly share code, notes, and snippets.

View Septdir's full-sized avatar

Igor Berdichevskiy Septdir

View GitHub Profile
@Septdir
Septdir / joomla-ajax.js
Last active April 5, 2020 17:14
Ajax request for joomla
let request = new XMLHttpRequest(),
requestUrl = '', // Указываем url запроса
formData = new FormData(); // Перадаем <form> или просто добавляем ниже через append что нужно
request.open('POST', requestUrl);
request.send(formData);
request.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
let response = false;
try {
@Septdir
Septdir / install_jyproextra.php
Created February 28, 2020 22:47
Install jYProExtra in insall script
<?php
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
@Septdir
Septdir / joomla-form-uikit.php
Last active October 11, 2019 11:15
Set uikit classes to joomla form
<?php
// Set uikit form
foreach ($this->form->getFieldsets() as $key => $fieldset)
{
foreach ($this->form->getFieldset($key) as $field)
{
$name = $field->fieldname;
$group = $field->group;
$type = strtolower($field->type);
$class = $this->form->getFieldAttribute($name, 'class', '', $group);
@Septdir
Septdir / donate-solution.html
Last active August 16, 2019 21:21
Simple donate form for Yandex.Money and PayPal.Based on uikit3
<div class="uk-form uk-form-horizontal" donate-form="form">
<div class="uk-margin">
<div class="uk-form-label">Сервис</div>
<div class="uk-form-controls">
<div class="uk-button-group">
<a class="uk-button uk-button-default" donate-form="service_button"
data-service="yandex">Яндекс.Деньги</a>
<a class="uk-button uk-button-default" donate-form="service_button" data-service="paypal">PayPal</a>
</div>
<input type="hidden" donate-form="service">
@Septdir
Septdir / popup.js
Last active July 21, 2019 15:19
Open popup window
document.addEventListener("DOMContentLoaded", function () {
let popups = document.querySelectorAll('[popup]');
if (popups) {
popups.forEach(function (element) {
// Get url
let url = '';
if (element.getAttribute('href')) {
url = element.getAttribute('href');
} else if (element.getAttribute('popup')) {
url = element.getAttribute('popup');
@Septdir
Septdir / nativeratioheight.js
Last active May 13, 2019 12:33
JS - Ratio Height
document.addEventListener("DOMContentLoaded", function () {
setRatioHeight();
setMinRatioHeight();
});
window.addEventListener('resize', function () {
setRatioHeight();
setMinRatioHeight();
});
function setRatioHeight() {
@Septdir
Septdir / array_sort.php
Created February 10, 2019 11:38
sort array
public function arraySort($array = array(), $fields = array())
{
if (!empty($array) && !empty($fields))
{
usort($array, function ($a, $b) use ($fields) {
$res = 0;
foreach ($fields as $k => $v)
{
if ($a->$k == $b->$k) continue;
$res = ($a->$k < $b->$k) ? -1 : 1;
@Septdir
Septdir / admin.ini
Last active April 20, 2018 10:51
Joomla переименовка Меткок в Тэги
COM_TAGS="Теги"
COM_TAGS_ALL_TAGS_DESCRIPTION_DESC="Описание для отображения в заголовке списка тегов"
COM_TAGS_ALL_TAGS_MEDIA_DESC="Изображение для отображение в заголовке списка тегов"
COM_TAGS_BASE_ADD_TITLE="Менеджер тегов: Создание тега"
COM_TAGS_BASE_EDIT_TITLE="Менеджер тегов: Редактирование тега"
COM_TAGS_BATCH_CANNOT_CREATE="У вас недостаточно прав для создания новых тегов."
COM_TAGS_BATCH_CANNOT_EDIT="У вас недостаточно прав для редактирования тегов."
COM_TAGS_BATCH_OPTIONS="Групповая операция над выбранными тегам"
COM_TAGS_BATCH_TIP="Действия будут выполнены над выбранными тегами."
COM_TAGS_CONFIG_ALL_TAGS_FIELD_LAYOUT_DESC="Выберите макет по умолчанию для Списка всех тегов."
@Septdir
Septdir / category.xml
Created March 2, 2018 14:20
Joomla - com_content override
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="JCATEGORY" option="COM_CONTENT_CATEGORY_VIEW_DEFAULT_OPTION">
<help key="JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORY_LIST"/>
<message>
<![CDATA[COM_CONTENT_CATEGORY_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_categories/models/fields">
@Septdir
Septdir / vk-widget-comments-count.js
Created March 2, 2018 14:14
VK Widget Comments Count
function vkCommentsCount() {
$($('[data-vkcomments-cout]')).each(function () {
var element = $(this);
var url = element.data('vkcomments-cout');
if (url == '') {
var url = location.href;
}
var data = {};
data.widget_api_id = 6187339; // id приложения
data.url = url;