forked from pikusov/Simpla
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from pulse-studio/master
single_name отсутствует
- Loading branch information
Showing
21 changed files
with
146 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
.admin-bookmark{ | ||
position:absolute; | ||
left:3%; | ||
top:0px; | ||
width: 12px; | ||
height: 35px; | ||
background-image: url(bookmark.gif); | ||
background-repeat: no-repeat; | ||
} | ||
.admin-tooltip{ | ||
position: absolute; | ||
visibility: hidden; | ||
opacity: 0; | ||
z-index: 9999; | ||
transition: all .3s ease .1s; | ||
width: 200px; | ||
padding-top: 10px; | ||
top: 0; | ||
left: 0; | ||
} | ||
.admin-tooltip-inner{ | ||
padding: 5px 10px; | ||
background: #ffedb6; | ||
border: 1px solid #FFC107; | ||
border-radius: 3px; | ||
position: relative; | ||
box-shadow: 0 5px 5px -5px #d4ad38; | ||
} | ||
|
||
.admin-tooltip a{ | ||
display: block; | ||
color: #795548; | ||
padding: 3px 2px 3px 20px; | ||
background-position: left center; | ||
background-repeat: no-repeat; | ||
text-decoration: none; | ||
} | ||
.admin-tooltip a:hover{ | ||
color: #ec6331; | ||
} | ||
.admin-tooltip:hover, | ||
.admin-tooltip.admin-tooltip-visible{ | ||
visibility: visible; | ||
opacity: 1; | ||
transition: none; | ||
} | ||
.admin-tooltip-edit { | ||
background-image:url(edit.png); | ||
} | ||
.admin-tooltip-add { | ||
background-image:url(add.png); | ||
} | ||
.admin-tooltip-inner:before{ | ||
content: ''; | ||
display: block; | ||
position: absolute; | ||
border: 4px solid transparent; | ||
top: -8px; | ||
left: 10px; | ||
border-bottom-color: #ffc107; | ||
} | ||
.admin-tooltip-inner:after{ | ||
content: ''; | ||
display: block; | ||
position: absolute; | ||
border: 4px solid transparent; | ||
top: -7px; | ||
left: 10px; | ||
border-bottom-color: #ffedb6; | ||
} | ||
.flipped .admin-tooltip-inner:before, | ||
.flipped .admin-tooltip-inner:after{ | ||
left: auto; | ||
right: 10px | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,164 +1,78 @@ | ||
$(function() { | ||
if(!('live' in jQuery.fn)) | ||
(function($){ | ||
'use strict'; | ||
|
||
$('<a href="simpla/" class="admin-bookmark"></a>').appendTo('body'); | ||
|
||
var $tooltip = $('<div>', { class: 'admin-tooltip', html: $('<div>', {class: 'admin-tooltip-inner'}) }).appendTo('body'); | ||
var tooltipCanClose = false; | ||
|
||
$(document) | ||
.on('mouseover', '[data-page]', show_tooltip) | ||
.on('mouseover', '[data-category]', show_tooltip) | ||
.on('mouseover', '[data-brand]', show_tooltip) | ||
.on('mouseover', '[data-product]', show_tooltip) | ||
.on('mouseover', '[data-post]', show_tooltip) | ||
.on('mouseover', '[data-feature]', show_tooltip); | ||
|
||
function show_tooltip() | ||
{ | ||
jQuery.fn.extend({ | ||
live: function (event, callback) { | ||
if (this.selector) { | ||
jQuery(document).on(event, this.selector, callback); | ||
} | ||
} | ||
var $link = $(this); | ||
|
||
$tooltip.addClass('admin-tooltip-visible'); | ||
|
||
$link.on('mouseleave', function(){ | ||
$tooltip.removeClass('admin-tooltip-visible'); | ||
}); | ||
} | ||
$("<a href='simpla/' class='admin_bookmark'></a>").appendTo('body'); | ||
tooltip = $("<div class='tooltip'><div class='tooltipHeader'></div><div class='tooltipBody'></div><div class='tooltipFooter'></div></div>").appendTo($('body')); | ||
$('.tooltip').live('mouseleave', function(){tooltipcanclose=true;setTimeout("close_tooltip();", 300);}); | ||
$('.tooltip').live('mouseover', function(){tooltipcanclose=false;}); | ||
|
||
$('[data-page]').live('mouseover', show_tooltip); | ||
$('[data-category]').live('mouseover', show_tooltip); | ||
$('[data-brand]').live('mouseover', show_tooltip); | ||
$('[data-product]').live('mouseover', show_tooltip); | ||
$('[data-post]').live('mouseover', show_tooltip); | ||
$('[data-feature]').live('mouseover', show_tooltip); | ||
}); | ||
|
||
function show_tooltip() | ||
{ | ||
tooltipcanclose=false; | ||
tooltip.show(); | ||
$(this).live('mouseleave', function(){tooltipcanclose=true;setTimeout("close_tooltip();", 500);}); | ||
|
||
|
||
|
||
flip = !($(this).offset().left+tooltip.width()+25 < $('body').width()); | ||
|
||
tooltip.css('top', $(this).height() + 5 + $(this).offset().top + 'px'); | ||
tooltip.css('left', ($(this).offset().left + $(this).outerWidth()*0.5 - (flip ? tooltip.width()-40 : 0) + 0) + 'px'); | ||
tooltip.find('.tooltipHeader').addClass(flip ? 'tooltipHeaderFlip' : 'tooltipHeaderDirect').removeClass(flip ? 'tooltipHeaderDirect' : 'tooltipHeaderFlip'); | ||
|
||
from = encodeURIComponent(window.location); | ||
tooltipcontent = ''; | ||
|
||
if(id = $(this).attr('data-page')) | ||
{ | ||
tooltipcontent = "<a href='simpla/index.php?module=PageAdmin&id="+id+"&return="+from+"' class=admin_tooltip_edit>Редактировать</a>"; | ||
tooltipcontent += "<a href='simpla/index.php?module=PageAdmin&return="+from+"' class=admin_tooltip_add>Добавить страницу</a>"; | ||
} | ||
|
||
if(id = $(this).attr('data-category')) | ||
{ | ||
tooltipcontent = "<a href='simpla/index.php?module=CategoryAdmin&id="+id+"&return="+from+"' class=admin_tooltip_edit>Редактировать</a>"; | ||
tooltipcontent += "<a href='simpla/index.php?module=ProductAdmin&category_id="+id+"&return="+from+"' class=admin_tooltip_add>Добавить товар</a>"; | ||
var flip = $link.offset().left + $tooltip.width() + 25 > $('body').width(); | ||
|
||
$tooltip | ||
.css({ | ||
'top': $link.height() + $link.offset().top + 'px', | ||
'left': $link.offset().left - (flip ? $tooltip.width() - $link.outerWidth(true) : 0) + 'px' | ||
}) | ||
.removeClass('flipped') | ||
.addClass(flip ? 'flipped' : ''); | ||
|
||
var urlFrom = encodeURIComponent(window.location); | ||
var tooltipContent = ''; | ||
|
||
var id = ''; | ||
|
||
if(id = $link.attr('data-page')) | ||
tooltipContent = createTooltipContent('PageAdmin', id, urlFrom); | ||
else if(id = $link.attr('data-category')) | ||
tooltipContent = createTooltipContent('CategoryAdmin', id, urlFrom); | ||
else if(id = $link.attr('data-brand')) | ||
tooltipContent = createTooltipContent('BrandAdmin', id, urlFrom); | ||
else if(id = $link.attr('data-product')) | ||
tooltipContent = createTooltipContent('ProductAdmin', id, urlFrom); | ||
else if(id = $link.attr('data-post')) | ||
tooltipContent = createTooltipContent('PostAdmin', id, urlFrom); | ||
else if(id = $link.attr('data-feature')) | ||
tooltipContent = createTooltipContent('FeatureAdmin', id, urlFrom); | ||
|
||
$tooltip.find('.admin-tooltip-inner').html( tooltipContent ); | ||
} | ||
|
||
if(id = $(this).attr('data-brand')) | ||
{ | ||
tooltipcontent = "<a href='simpla/index.php?module=BrandAdmin&id="+id+"&return="+from+"' class=admin_tooltip_edit>Редактировать</a>"; | ||
} | ||
|
||
if(id = $(this).attr('data-product')) | ||
{ | ||
tooltipcontent = "<a href='simpla/index.php?module=ProductAdmin&id="+id+"&return="+from+"' class=admin_tooltip_edit>Редактировать</a>"; | ||
} | ||
|
||
if(id = $(this).attr('data-post')) | ||
{ | ||
tooltipcontent = "<a href='simpla/index.php?module=PostAdmin&id="+id+"&return="+from+"' class=admin_tooltip_edit>Редактировать</a>"; | ||
} | ||
|
||
if(id = $(this).attr('data-feature')) | ||
{ | ||
tooltipcontent = "<a href='simpla/index.php?module=FeatureAdmin&id="+id+"&return="+from+"' class=admin_tooltip_edit>Редактировать</a>"; | ||
} | ||
|
||
$('.tooltipBody').html(tooltipcontent); | ||
} | ||
|
||
function close_tooltip() | ||
{ | ||
if(tooltipcanclose) | ||
{ | ||
tooltipcanclose=false; | ||
tooltip.hide(); | ||
} | ||
} | ||
|
||
function SetTooltips() { | ||
elements = document.getElementsByTagName("body")[0].getElementsByTagName("*"); | ||
|
||
for (i = 0; i <elements.length; i++) | ||
{ | ||
tooltip = elements[i].getAttribute('tooltip'); | ||
if(tooltip) | ||
function createTooltipContent(module, id, urlFrom){ | ||
var $linkEdit = $('<a>', { | ||
href: 'simpla/index.php?module=' + module + '&id=' + id + '&return=' + urlFrom, | ||
class: 'admin-tooltip-edit', | ||
text: 'Редактировать' | ||
}); | ||
|
||
if(module == 'PageAdmin' || module == 'CategoryAdmin') | ||
{ | ||
elements[i].onmouseout = function(e) {tooltipcanclose=true;setTimeout("CloseTooltip();", 1000);}; | ||
switch(tooltip) | ||
{ | ||
case 'product': | ||
elements[i].onmouseover = function(e) {AdminProductTooltip(this, this.getAttribute('product_id'));tooltipcanclose=false;} | ||
break; | ||
case 'hit': | ||
elements[i].onmouseover = function(e) {AdminHitTooltip(this, this.getAttribute('product_id'));tooltipcanclose=false;tooltipcanclose=false;} | ||
break; | ||
case 'category': | ||
elements[i].onmouseover = function(e) {AdminCategoryTooltip(this, this.getAttribute('category_id'));tooltipcanclose=false;} | ||
break; | ||
case 'news': | ||
elements[i].onmouseover = function(e) {AdminNewsTooltip(this, this.getAttribute('news_id'));tooltipcanclose=false;} | ||
break; | ||
case 'article': | ||
elements[i].onmouseover = function(e) {AdminArticleTooltip(this, this.getAttribute('article_id'));tooltipcanclose=false;} | ||
break; | ||
case 'page': | ||
elements[i].onmouseover = function(e) {AdminPageTooltip(this, this.getAttribute('id')); tooltipcanclose=false;} | ||
break; | ||
case 'currency': | ||
elements[i].onmouseover = function(e) {AdminCurrencyTooltip(this); tooltipcanclose=false;} | ||
break; | ||
} | ||
|
||
|
||
var $linkAdd = $('<a>', { | ||
href: 'simpla/index.php?module=' + (module == 'CategoryAdmin' ? 'ProductAdmin&category_id=' + id : module) + '&return=' + urlFrom, | ||
class: 'admin-tooltip-add', | ||
text: module == 'PageAdmin' ? 'Добавить страницу' : 'Добавить товар' | ||
}); | ||
|
||
return [$linkEdit, $linkAdd]; | ||
} | ||
|
||
return $linkEdit; | ||
} | ||
|
||
} | ||
|
||
|
||
function ShowTooltip(i, content) { | ||
|
||
tooltip = document.getElementById('tooltip'); | ||
|
||
document.getElementById('tooltipBody').innerHTML = content; | ||
tooltip.style.display = 'block'; | ||
|
||
var xleft=0; | ||
var xtop=0; | ||
o = i; | ||
|
||
do { | ||
xleft += o.offsetLeft; | ||
xtop += o.offsetTop; | ||
|
||
} while (o=o.offsetParent); | ||
|
||
xwidth = i.offsetWidth ? i.offsetWidth : i.style.pixelWidth; | ||
xheight = i.offsetHeight ? i.offsetHeight : i.style.pixelHeight; | ||
|
||
bwidth = tooltip.offsetWidth ? tooltip.offsetWidth : tooltip.style.pixelWidth; | ||
|
||
w = window; | ||
|
||
xbody = document.compatMode=='CSS1Compat' ? w.document.documentElement : w.document.body; | ||
dwidth = xbody.clientWidth ? xbody.clientWidth : w.innerWidth; | ||
bwidth = tooltip.offsetWidth ? tooltip.offsetWidth : tooltip.style.pixelWidth; | ||
|
||
flip = !( 25 + xleft + bwidth < dwidth); | ||
|
||
tooltip.style.top = xheight - 3 + xtop + 'px'; | ||
tooltip.style.left = (xleft - (flip ? bwidth : 0) + 25) + 'px'; | ||
|
||
document.getElementById('tooltipHeader').className = flip ? 'tooltipHeaderFlip' : 'tooltipHeaderDirect'; | ||
|
||
return false; | ||
} | ||
})(window.jQuery); |
File renamed without changes
Oops, something went wrong.