mirror of
https://github.com/fergalmoran/dss.web.git
synced 2026-02-15 04:25:41 +00:00
Some flat fixed to user profile
This commit is contained in:
@@ -123,10 +123,17 @@ angular.module('dssWebApp')
|
||||
};
|
||||
|
||||
$scope.deleteMix = function (mix) {
|
||||
var dlg = dialogs.create('app/dialogs/confirm/confirmDialog.html', 'confirmDialogCtrl', {
|
||||
title: "Delete this mix?",
|
||||
body: mix.title
|
||||
});
|
||||
var dlg = dialogs.create(
|
||||
'app/dialogs/confirm/confirmDialog.html',
|
||||
'confirmDialogCtrl',
|
||||
{
|
||||
title: "Delete this mix?",
|
||||
body: mix.title
|
||||
},
|
||||
{
|
||||
size: "sm"
|
||||
}
|
||||
);
|
||||
dlg.result.then(function (result) {
|
||||
if (result) {
|
||||
MixModel.destroy(mix.slug).then(function () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="box">
|
||||
<div class="box col-md-4">
|
||||
<div class="box-title">
|
||||
<div class="actions">
|
||||
<a ng-click="play($event)" class="btn btn-xs btn-primary"
|
||||
@@ -18,6 +18,6 @@
|
||||
<div class="box-content">
|
||||
<a ui-sref="root.user.mix({user: mix.user.slug, mix: mix.slug})"><img ng-src="{{mix.mix_image}}"/>
|
||||
</a>
|
||||
<h5>{{mix.title}}</h5>
|
||||
<h5 class="text-nowrap dss-truncate">{{mix.title}}</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,63 +13,38 @@
|
||||
<br/>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="box">
|
||||
<div class="box-title">
|
||||
<h3>About</h3>
|
||||
<div class="actions">
|
||||
<button class="btn btn-link"
|
||||
ng-click="startChat(user.slug)"
|
||||
data-toggle="tooltip" title="Chat">
|
||||
<i class="fa fa-comment"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="text-indent" ng-bind-html="user.description"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<div class="box-title">
|
||||
<h3>Followers</h3>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div ng-repeat="follower in user.followers" class="col-xs-4 col-sm-3 col-lg-2 block-section">
|
||||
<a ui-sref="root.user({user: follower.slug})">
|
||||
<img ng-src="{{follower.profile_image_small}}" alt="image" data-toggle="tooltip"
|
||||
title="{{follower.display_name}}" class="img-circle user-profile-insert"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-heading">About</div>
|
||||
<div class="panel-body" ng-bind-html="user.description"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div ng-show="user.mix_count != 0" class="box">
|
||||
<div class="box-title">
|
||||
<h3>{{mixTitle}}
|
||||
<strong> Mixes</strong>
|
||||
</h3>
|
||||
<div class="actions">
|
||||
<a data-toggle="tooltip" title="Popular Mixes"
|
||||
ng-click="showPopular()"
|
||||
class="btn btn-alt btn-sm btn-default">
|
||||
<i class="glyphicon glyphicon-thumbs-up"></i>
|
||||
</a>
|
||||
<a data-toggle="tooltip" title="Latest Mixes"
|
||||
ng-click="showLatest()"
|
||||
class="btn btn-alt btn-sm btn-default">
|
||||
<i class="glyphicon glyphicon-time"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="gallery">
|
||||
<div class="row">
|
||||
<div ng-repeat="mix in mixes" class="col-xs-6 col-sm-4">
|
||||
<dss-audio-player template="views/templates/audioGallery.html"></dss-audio-player>
|
||||
<div ng-show="user.mix_count != 0">
|
||||
<section class="panel">
|
||||
<header class="panel-heading tab-bg-dark-navy-blue">
|
||||
<ul class="nav nav-tabs" id="mixes-tabs">
|
||||
<li class="active"><a href="#latest" data-toggle="tab" data-dss-ordering="-id">Latest mixes</a></li>
|
||||
<li><a href="#popular" data-toggle="tab" data-dss-ordering="-play_count">Popular mixes</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
<div class="panel-body">
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content tasi-tab">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="latest">
|
||||
<ul ng-repeat="mix in mixes" class="grid cs-style-3">
|
||||
<dss-audio-player template="views/templates/audioGallery.html"></dss-audio-player>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-pane" id="popular">
|
||||
<ul ng-repeat="mix in mixes" class="grid cs-style-3">
|
||||
<dss-audio-player template="views/templates/audioGallery.html"></dss-audio-player>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,27 +4,22 @@ angular.module('dssWebApp')
|
||||
.controller('UserItemCtrl', function ($scope, UserModel, MixModel, user, logger) {
|
||||
logger.logSuccess('UserItemCtrl', $scope);
|
||||
$scope.user = user;
|
||||
$scope.showLatest = function () {
|
||||
function _getMixes (ordering) {
|
||||
$scope.mixTitle = "Latest";
|
||||
MixModel.findAll({
|
||||
user__slug: user.slug,
|
||||
waveform_generated: "True",
|
||||
ordering: "-id"
|
||||
limit: 6,
|
||||
ordering: ordering
|
||||
}).then(function (mixes) {
|
||||
$scope.mixes = mixes;
|
||||
$scope.mixPage = 1;
|
||||
});
|
||||
};
|
||||
$scope.showPopular = function () {
|
||||
$scope.mixTitle = "Popular";
|
||||
MixModel.findAll({
|
||||
user__slug: user.slug,
|
||||
waveform_generated: "True",
|
||||
ordering: "-play_count"
|
||||
}).then(function (mixes) {
|
||||
$scope.mixes = mixes;
|
||||
$scope.mixPage = 1;
|
||||
});
|
||||
};
|
||||
$scope.showLatest();
|
||||
}
|
||||
_getMixes("-id");
|
||||
$('#mixes-tabs').find('a').click(function (e) {
|
||||
console.log("Tabbing");
|
||||
e.preventDefault();
|
||||
_getMixes($(e.target).data("dss-ordering"));
|
||||
});
|
||||
});
|
||||
@@ -16,62 +16,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div ng-repeat="user in users" class="col-md-4">
|
||||
<div class="widget">
|
||||
<div class="widget-advanced widget-advanced-alt">
|
||||
<div class="widget-header text-left">
|
||||
<img ng-src="{{user.profile_image_header}}" alt="background"
|
||||
class="widget-background animation-pulseSlow">
|
||||
<h3 class="widget-content widget-content-image widget-content-light clearfix">
|
||||
<a ui-sref="root.user({user: user.slug})" class="pull-right">
|
||||
<img ng-src="{{user.profile_image_medium}}" alt="avatar" class="widget-image img-circle">
|
||||
</a>
|
||||
<a ui-sref="root.user({user: user.slug})"
|
||||
class="themed-color-autumn">{{user.display_name}}</a>
|
||||
<br>
|
||||
<small>{{user.title}}</small>
|
||||
</h3>
|
||||
<div class="widget-options block-options">
|
||||
<button class="btn btn-xs btn-primary"
|
||||
ng-click="startChat(user.slug)"
|
||||
data-toggle="tooltip" title="Chat">
|
||||
<i class="fa fa-comment"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-main">
|
||||
<div class="row text-center animation-fadeIn">
|
||||
<div class="col-xs-4">
|
||||
<h3>
|
||||
<a href="javascript:void(0)" class="themed-color-autumn">
|
||||
<strong>12</strong>
|
||||
</a>
|
||||
<br>
|
||||
<small>Trips</small>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<h3>
|
||||
<a href="javascript:void(0)" class="themed-color-autumn">
|
||||
<strong>21</strong>
|
||||
</a>
|
||||
<br>
|
||||
<small>Cities</small>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<h3>
|
||||
<a href="javascript:void(0)" class="themed-color-autumn">
|
||||
<strong>3</strong>
|
||||
</a>
|
||||
<br>
|
||||
<small>Stories</small>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
@@ -1,640 +0,0 @@
|
||||
(function ($, undef) {
|
||||
if ($.fn.dotdotdot) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.fn.dotdotdot = function (o) {
|
||||
if (this.length == 0) {
|
||||
$.fn.dotdotdot.debug('No element found for "' + this.selector + '".');
|
||||
return this;
|
||||
}
|
||||
if (this.length > 1) {
|
||||
return this.each(
|
||||
function () {
|
||||
$(this).dotdotdot(o);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var $dot = this;
|
||||
var orgContent = $dot.contents();
|
||||
|
||||
if ($dot.data('dotdotdot')) {
|
||||
$dot.trigger('destroy.dot');
|
||||
}
|
||||
|
||||
$dot.data('dotdotdot-style', $dot.attr('style') || '');
|
||||
$dot.css('word-wrap', 'break-word');
|
||||
if ($dot.css('white-space') === 'nowrap') {
|
||||
$dot.css('white-space', 'normal');
|
||||
}
|
||||
|
||||
$dot.bind_events = function () {
|
||||
$dot.bind(
|
||||
'update.dot',
|
||||
function (e, c) {
|
||||
$dot.removeClass("is-truncated");
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
switch (typeof opts.height) {
|
||||
case 'number':
|
||||
opts.maxHeight = opts.height;
|
||||
break;
|
||||
|
||||
case 'function':
|
||||
opts.maxHeight = opts.height.call($dot[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
opts.maxHeight = getTrueInnerHeight($dot);
|
||||
break;
|
||||
}
|
||||
|
||||
opts.maxHeight += opts.tolerance;
|
||||
|
||||
if (typeof c != 'undefined') {
|
||||
if (typeof c == 'string' || ('nodeType' in c && c.nodeType === 1)) {
|
||||
c = $('<div />').append(c).contents();
|
||||
}
|
||||
if (c instanceof $) {
|
||||
orgContent = c;
|
||||
}
|
||||
}
|
||||
|
||||
$inr = $dot.wrapInner('<div class="dotdotdot" />').children();
|
||||
$inr.contents()
|
||||
.detach()
|
||||
.end()
|
||||
.append(orgContent.clone(true))
|
||||
.find('br')
|
||||
.replaceWith(' <br /> ')
|
||||
.end()
|
||||
.css({
|
||||
'height': 'auto',
|
||||
'width': 'auto',
|
||||
'border': 'none',
|
||||
'padding': 0,
|
||||
'margin': 0
|
||||
});
|
||||
|
||||
var after = false,
|
||||
trunc = false;
|
||||
|
||||
if (conf.afterElement) {
|
||||
after = conf.afterElement.clone(true);
|
||||
after.show();
|
||||
conf.afterElement.detach();
|
||||
}
|
||||
|
||||
if (test($inr, opts)) {
|
||||
if (opts.wrap == 'children') {
|
||||
trunc = children($inr, opts, after);
|
||||
}
|
||||
else {
|
||||
trunc = ellipsis($inr, $dot, $inr, opts, after);
|
||||
}
|
||||
}
|
||||
$inr.replaceWith($inr.contents());
|
||||
$inr = null;
|
||||
|
||||
if ($.isFunction(opts.callback)) {
|
||||
opts.callback.call($dot[0], trunc, orgContent);
|
||||
}
|
||||
|
||||
conf.isTruncated = trunc;
|
||||
return trunc;
|
||||
}
|
||||
).bind(
|
||||
'isTruncated.dot',
|
||||
function (e, fn) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (typeof fn == 'function') {
|
||||
fn.call($dot[0], conf.isTruncated);
|
||||
}
|
||||
return conf.isTruncated;
|
||||
}
|
||||
).bind(
|
||||
'originalContent.dot',
|
||||
function (e, fn) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (typeof fn == 'function') {
|
||||
fn.call($dot[0], orgContent);
|
||||
}
|
||||
return orgContent;
|
||||
}
|
||||
).bind(
|
||||
'destroy.dot',
|
||||
function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
$dot.unwatch()
|
||||
.unbind_events()
|
||||
.contents()
|
||||
.detach()
|
||||
.end()
|
||||
.append(orgContent)
|
||||
.attr('style', $dot.data('dotdotdot-style') || '')
|
||||
.removeClass('is-truncated')
|
||||
.data('dotdotdot', false);
|
||||
}
|
||||
);
|
||||
return $dot;
|
||||
}; // /bind_events
|
||||
|
||||
$dot.unbind_events = function () {
|
||||
$dot.unbind('.dot');
|
||||
return $dot;
|
||||
}; // /unbind_events
|
||||
|
||||
$dot.watch = function () {
|
||||
$dot.unwatch();
|
||||
if (opts.watch == 'window') {
|
||||
var $window = $(window),
|
||||
_wWidth = $window.width(),
|
||||
_wHeight = $window.height();
|
||||
|
||||
$window.bind(
|
||||
'resize.dot' + conf.dotId,
|
||||
function () {
|
||||
if (_wWidth != $window.width() || _wHeight != $window.height() || !opts.windowResizeFix) {
|
||||
_wWidth = $window.width();
|
||||
_wHeight = $window.height();
|
||||
|
||||
if (watchInt) {
|
||||
clearInterval(watchInt);
|
||||
}
|
||||
watchInt = setTimeout(
|
||||
function () {
|
||||
$dot.trigger('update.dot');
|
||||
}, 100
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
watchOrg = getSizes($dot);
|
||||
watchInt = setInterval(
|
||||
function () {
|
||||
if ($dot.is(':visible')) {
|
||||
var watchNew = getSizes($dot);
|
||||
if (watchOrg.width != watchNew.width ||
|
||||
watchOrg.height != watchNew.height) {
|
||||
$dot.trigger('update.dot');
|
||||
watchOrg = watchNew;
|
||||
}
|
||||
}
|
||||
}, 500
|
||||
);
|
||||
}
|
||||
return $dot;
|
||||
};
|
||||
$dot.unwatch = function () {
|
||||
$(window).unbind('resize.dot' + conf.dotId);
|
||||
if (watchInt) {
|
||||
clearInterval(watchInt);
|
||||
}
|
||||
return $dot;
|
||||
};
|
||||
|
||||
var opts = $.extend(true, {}, $.fn.dotdotdot.defaults, o),
|
||||
conf = {},
|
||||
watchOrg = {},
|
||||
watchInt = null,
|
||||
$inr = null;
|
||||
|
||||
|
||||
if (!( opts.lastCharacter.remove instanceof Array )) {
|
||||
opts.lastCharacter.remove = $.fn.dotdotdot.defaultArrays.lastCharacter.remove;
|
||||
}
|
||||
if (!( opts.lastCharacter.noEllipsis instanceof Array )) {
|
||||
opts.lastCharacter.noEllipsis = $.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis;
|
||||
}
|
||||
|
||||
|
||||
conf.afterElement = getElement(opts.after, $dot);
|
||||
conf.isTruncated = false;
|
||||
conf.dotId = dotId++;
|
||||
|
||||
|
||||
$dot.data('dotdotdot', true)
|
||||
.bind_events()
|
||||
.trigger('update.dot');
|
||||
|
||||
if (opts.watch) {
|
||||
$dot.watch();
|
||||
}
|
||||
|
||||
return $dot;
|
||||
};
|
||||
|
||||
// public
|
||||
$.fn.dotdotdot.defaults = {
|
||||
'ellipsis': '... ',
|
||||
'wrap': 'word',
|
||||
'fallbackToLetter': true,
|
||||
'lastCharacter': {},
|
||||
'tolerance': 0,
|
||||
'callback': null,
|
||||
'after': null,
|
||||
'height': null,
|
||||
'watch': false,
|
||||
'windowResizeFix': true
|
||||
};
|
||||
$.fn.dotdotdot.defaultArrays = {
|
||||
'lastCharacter': {
|
||||
'remove': [' ', '\u3000', ',', ';', '.', '!', '?'],
|
||||
'noEllipsis': []
|
||||
}
|
||||
};
|
||||
$.fn.dotdotdot.debug = function (msg) {
|
||||
};
|
||||
|
||||
|
||||
// private
|
||||
var dotId = 1;
|
||||
|
||||
function children($elem, o, after) {
|
||||
var $elements = $elem.children(),
|
||||
isTruncated = false;
|
||||
|
||||
$elem.empty();
|
||||
|
||||
for (var a = 0, l = $elements.length; a < l; a++) {
|
||||
var $e = $elements.eq(a);
|
||||
$elem.append($e);
|
||||
if (after) {
|
||||
$elem.append(after);
|
||||
}
|
||||
if (test($elem, o)) {
|
||||
$e.remove();
|
||||
isTruncated = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (after) {
|
||||
after.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
return isTruncated;
|
||||
}
|
||||
|
||||
function ellipsis($elem, $d, $i, o, after) {
|
||||
var isTruncated = false;
|
||||
|
||||
// Don't put the ellipsis directly inside these elements
|
||||
var notx = 'a, table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style';
|
||||
|
||||
// Don't remove these elements even if they are after the ellipsis
|
||||
var noty = 'script, .dotdotdot-keep';
|
||||
|
||||
$elem
|
||||
.contents()
|
||||
.detach()
|
||||
.each(
|
||||
function () {
|
||||
|
||||
var e = this,
|
||||
$e = $(e);
|
||||
|
||||
if (typeof e == 'undefined') {
|
||||
return true;
|
||||
}
|
||||
else if ($e.is(noty)) {
|
||||
$elem.append($e);
|
||||
}
|
||||
else if (isTruncated) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
$elem.append($e);
|
||||
if (after && !$e.is(o.after) && !$e.find(o.after).length) {
|
||||
$elem[$elem.is(notx) ? 'after' : 'append'](after);
|
||||
}
|
||||
if (test($i, o)) {
|
||||
if (e.nodeType == 3) // node is TEXT
|
||||
{
|
||||
isTruncated = ellipsisElement($e, $d, $i, o, after);
|
||||
}
|
||||
else {
|
||||
isTruncated = ellipsis($e, $d, $i, o, after);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isTruncated) {
|
||||
if (after) {
|
||||
after.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
$d.addClass("is-truncated");
|
||||
return isTruncated;
|
||||
}
|
||||
|
||||
function ellipsisElement($e, $d, $i, o, after) {
|
||||
var e = $e[0];
|
||||
|
||||
if (!e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var txt = getTextContent(e),
|
||||
space = ( txt.indexOf(' ') !== -1 ) ? ' ' : '\u3000',
|
||||
separator = ( o.wrap == 'letter' ) ? '' : space,
|
||||
textArr = txt.split(separator),
|
||||
position = -1,
|
||||
midPos = -1,
|
||||
startPos = 0,
|
||||
endPos = textArr.length - 1;
|
||||
|
||||
|
||||
// Only one word
|
||||
if (o.fallbackToLetter && startPos == 0 && endPos == 0) {
|
||||
separator = '';
|
||||
textArr = txt.split(separator);
|
||||
endPos = textArr.length - 1;
|
||||
}
|
||||
|
||||
while (startPos <= endPos && !( startPos == 0 && endPos == 0 )) {
|
||||
var m = Math.floor(( startPos + endPos ) / 2);
|
||||
if (m == midPos) {
|
||||
break;
|
||||
}
|
||||
midPos = m;
|
||||
|
||||
setTextContent(e, textArr.slice(0, midPos + 1).join(separator) + o.ellipsis);
|
||||
$i.children()
|
||||
.each(
|
||||
function () {
|
||||
$(this).toggle().toggle();
|
||||
}
|
||||
);
|
||||
|
||||
if (!test($i, o)) {
|
||||
position = midPos;
|
||||
startPos = midPos;
|
||||
}
|
||||
else {
|
||||
endPos = midPos;
|
||||
|
||||
// Fallback to letter
|
||||
if (o.fallbackToLetter && startPos == 0 && endPos == 0) {
|
||||
separator = '';
|
||||
textArr = textArr[0].split(separator);
|
||||
position = -1;
|
||||
midPos = -1;
|
||||
startPos = 0;
|
||||
endPos = textArr.length - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (position != -1 && !( textArr.length == 1 && textArr[0].length == 0 )) {
|
||||
txt = addEllipsis(textArr.slice(0, position + 1).join(separator), o);
|
||||
setTextContent(e, txt);
|
||||
}
|
||||
else {
|
||||
var $w = $e.parent();
|
||||
$e.detach();
|
||||
|
||||
var afterLength = ( after && after.closest($w).length ) ? after.length : 0;
|
||||
|
||||
if ($w.contents().length > afterLength) {
|
||||
e = findLastTextNode($w.contents().eq(-1 - afterLength), $d);
|
||||
}
|
||||
else {
|
||||
e = findLastTextNode($w, $d, true);
|
||||
if (!afterLength) {
|
||||
$w.detach();
|
||||
}
|
||||
}
|
||||
if (e) {
|
||||
txt = addEllipsis(getTextContent(e), o);
|
||||
setTextContent(e, txt);
|
||||
if (afterLength && after) {
|
||||
$(e).parent().append(after);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function test($i, o) {
|
||||
return $i.innerHeight() > o.maxHeight;
|
||||
}
|
||||
|
||||
function addEllipsis(txt, o) {
|
||||
while ($.inArray(txt.slice(-1), o.lastCharacter.remove) > -1) {
|
||||
txt = txt.slice(0, -1);
|
||||
}
|
||||
if ($.inArray(txt.slice(-1), o.lastCharacter.noEllipsis) < 0) {
|
||||
txt += o.ellipsis;
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
|
||||
function getSizes($d) {
|
||||
return {
|
||||
'width': $d.innerWidth(),
|
||||
'height': $d.innerHeight()
|
||||
};
|
||||
}
|
||||
|
||||
function setTextContent(e, content) {
|
||||
if (e.innerText) {
|
||||
e.innerText = content;
|
||||
}
|
||||
else if (e.nodeValue) {
|
||||
e.nodeValue = content;
|
||||
}
|
||||
else if (e.textContent) {
|
||||
e.textContent = content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getTextContent(e) {
|
||||
if (e.innerText) {
|
||||
return e.innerText;
|
||||
}
|
||||
else if (e.nodeValue) {
|
||||
return e.nodeValue;
|
||||
}
|
||||
else if (e.textContent) {
|
||||
return e.textContent;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function getPrevNode(n) {
|
||||
do
|
||||
{
|
||||
n = n.previousSibling;
|
||||
}
|
||||
while (n && n.nodeType !== 1 && n.nodeType !== 3);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
function findLastTextNode($el, $top, excludeCurrent) {
|
||||
var e = $el && $el[0], p;
|
||||
if (e) {
|
||||
if (!excludeCurrent) {
|
||||
if (e.nodeType === 3) {
|
||||
return e;
|
||||
}
|
||||
if ($.trim($el.text())) {
|
||||
return findLastTextNode($el.contents().last(), $top);
|
||||
}
|
||||
}
|
||||
p = getPrevNode(e);
|
||||
while (!p) {
|
||||
$el = $el.parent();
|
||||
if ($el.is($top) || !$el.length) {
|
||||
return false;
|
||||
}
|
||||
p = getPrevNode($el[0]);
|
||||
}
|
||||
if (p) {
|
||||
return findLastTextNode($(p), $top);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getElement(e, $i) {
|
||||
if (!e) {
|
||||
return false;
|
||||
}
|
||||
if (typeof e === 'string') {
|
||||
e = $(e, $i);
|
||||
return ( e.length )
|
||||
? e
|
||||
: false;
|
||||
}
|
||||
return !e.jquery
|
||||
? false
|
||||
: e;
|
||||
}
|
||||
|
||||
function getTrueInnerHeight($el) {
|
||||
var h = $el.innerHeight(),
|
||||
a = ['paddingTop', 'paddingBottom'];
|
||||
|
||||
for (var z = 0, l = a.length; z < l; z++) {
|
||||
var m = parseInt($el.css(a[z]), 10);
|
||||
if (isNaN(m)) {
|
||||
m = 0;
|
||||
}
|
||||
h -= m;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
// override jQuery.html
|
||||
var _orgHtml = $.fn.html;
|
||||
$.fn.html = function (str) {
|
||||
if (str != undef && !$.isFunction(str) && this.data('dotdotdot')) {
|
||||
return this.trigger('update', [str]);
|
||||
}
|
||||
return _orgHtml.apply(this, arguments);
|
||||
};
|
||||
|
||||
|
||||
// override jQuery.text
|
||||
var _orgText = $.fn.text;
|
||||
$.fn.text = function (str) {
|
||||
if (str != undef && !$.isFunction(str) && this.data('dotdotdot')) {
|
||||
str = $('<div />').text(str).html();
|
||||
return this.trigger('update', [str]);
|
||||
}
|
||||
return _orgText.apply(this, arguments);
|
||||
};
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
||||
/*
|
||||
|
||||
## Automatic parsing for CSS classes
|
||||
Contributed by [Ramil Valitov](https://github.com/rvalitov)
|
||||
|
||||
### The idea
|
||||
You can add one or several CSS classes to HTML elements to automatically invoke "jQuery.dotdotdot functionality" and some extra features. It allows to use jQuery.dotdotdot only by adding appropriate CSS classes without JS programming.
|
||||
|
||||
### Available classes and their description
|
||||
* dot-ellipsis - automatically invoke jQuery.dotdotdot to this element. This class must be included if you plan to use other classes below.
|
||||
* dot-resize-update - automatically update if window resize event occurs. It's equivalent to option `watch:'window'`.
|
||||
* dot-timer-update - automatically update if window resize event occurs. It's equivalent to option `watch:true`.
|
||||
* dot-load-update - automatically update after the window has beem completely rendered. Can be useful if your content is generated dynamically using using JS and, hence, jQuery.dotdotdot can't correctly detect the height of the element before it's rendered completely.
|
||||
* dot-height-XXX - available height of content area in pixels, where XXX is a number, e.g. can be `dot-height-35` if you want to set maximum height for 35 pixels. It's equivalent to option `height:'XXX'`.
|
||||
|
||||
### Usage examples
|
||||
*Adding jQuery.dotdotdot to element*
|
||||
|
||||
<div class="dot-ellipsis">
|
||||
<p>Lorem Ipsum is simply dummy text.</p>
|
||||
</div>
|
||||
|
||||
*Adding jQuery.dotdotdot to element with update on window resize*
|
||||
|
||||
<div class="dot-ellipsis dot-resize-update">
|
||||
<p>Lorem Ipsum is simply dummy text.</p>
|
||||
</div>
|
||||
|
||||
*Adding jQuery.dotdotdot to element with predefined height of 50px*
|
||||
|
||||
<div class="dot-ellipsis dot-height-50">
|
||||
<p>Lorem Ipsum is simply dummy text.</p>
|
||||
</div>
|
||||
|
||||
*/
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
//We only invoke jQuery.dotdotdot on elements that have dot-ellipsis class
|
||||
$(".dot-ellipsis").each(function () {
|
||||
//Checking if update on window resize required
|
||||
var watch_window = $(this).hasClass("dot-resize-update");
|
||||
|
||||
//Checking if update on timer required
|
||||
var watch_timer = $(this).hasClass("dot-timer-update");
|
||||
|
||||
//Checking if height set
|
||||
var height = 0;
|
||||
var classList = $(this).attr('class').split(/\s+/);
|
||||
$.each(classList, function (index, item) {
|
||||
var matchResult = item.match(/^dot-height-(\d+)$/);
|
||||
if (matchResult !== null)
|
||||
height = Number(matchResult[1]);
|
||||
});
|
||||
|
||||
//Invoking jQuery.dotdotdot
|
||||
var x = new Object();
|
||||
if (watch_timer)
|
||||
x.watch = true;
|
||||
if (watch_window)
|
||||
x.watch = 'window';
|
||||
if (height > 0)
|
||||
x.height = height;
|
||||
$(this).dotdotdot(x);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//Updating elements (if any) on window.load event
|
||||
jQuery(window).on('load', function () {
|
||||
jQuery(".dot-ellipsis.dot-load-update").trigger("update.dot");
|
||||
});
|
||||
2022
client/assets/jquery.fancybox.js
vendored
Normal file
2022
client/assets/jquery.fancybox.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -148,7 +148,7 @@
|
||||
<script src="bower_components/SoundManager2/script/soundmanager2-nodebug.js"></script>
|
||||
<script src="assets/flatlab/bootstrap-fileupload.js"></script>
|
||||
<script src="assets/flatlab/pulstate.js"></script>
|
||||
<script src="assets/jquery.ellipsis.js"></script>
|
||||
<script src="assets/jquery.fancybox.js"></script>
|
||||
<script src="assets/utils.js"></script>
|
||||
<script src="assets/slimscroll/jquery.slimscroll.js"></script>
|
||||
<script src="assets/dropzone/dropzone.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user