Wie is er online?
Er zijn in totaal 1 gebruiker online :: 0 Geregistreerd, 0 verborgen en 1 gast
Geen
Het hoogste aantal gelijktijdige online gebruikers is 8. Dit aantal is bereikt op vr 02 feb 2024, 12:03.
Geen
Het hoogste aantal gelijktijdige online gebruikers is 8. Dit aantal is bereikt op vr 02 feb 2024, 12:03.
Personeel Online
Laatste onderwerpen
» Plaatje
van Prometheus vr 30 jun 2017, 14:22
» AWC v2.1 User Manual English (DRAFT)
van Samantha zo 29 jan 2017, 13:26
» *** CSS BACKUP 30-12-2016 ***
van Samantha vr 30 dec 2016, 12:27
» Test Announcement
van Samantha do 29 dec 2016, 16:32
» *** /H2-LOGIN H&F=ON HTML BACKUP 23-12-2016 ***
van Samantha vr 23 dec 2016, 14:25
» *** [FA EDGE] ALL.JS BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:23
» [RHFORUM] Topics.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:22
» *** [RHFORUM] Index.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:21
» *** [RHFORUM] Index+Topics.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:19
» *** [RHFORUM] AllPages.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:17
van Prometheus vr 30 jun 2017, 14:22
» AWC v2.1 User Manual English (DRAFT)
van Samantha zo 29 jan 2017, 13:26
» *** CSS BACKUP 30-12-2016 ***
van Samantha vr 30 dec 2016, 12:27
» Test Announcement
van Samantha do 29 dec 2016, 16:32
» *** /H2-LOGIN H&F=ON HTML BACKUP 23-12-2016 ***
van Samantha vr 23 dec 2016, 14:25
» *** [FA EDGE] ALL.JS BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:23
» [RHFORUM] Topics.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:22
» *** [RHFORUM] Index.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:21
» *** [RHFORUM] Index+Topics.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:19
» *** [RHFORUM] AllPages.js - ON BACKUP 20-12-2016 ***
van Samantha di 20 dec 2016, 17:17
Trefwoorden
*** [RHFORUM] AllPages.js - ON BACKUP 20-12-2016 ***
Pagina 1 van 1 • Deel
- Code:
//
// [RHFORUM] AllPages.js - ON
//
// TOC:
//
// 1. Login / Logout Redirector (H2-)
// 2. Auto-close Side Panels After 3 Seconds
// 3. Profile Preview
// 4. Live Search
// 5. Live Search Options
// 6. @Mentions Show Avatar
// 7. @Mentions Auto-Suggest
// 8. @Mentions All
// 9. Memberlist Alphabet Bar
// 10. Back to Top Arrow
// 11. Hide Profile Title :: Symbols
// 12. Smiley Meanings
// 13. SCEditor Image Button Combine
// 14. Add Code Snippet Button (Admins Only)
//
// 1. Login / Logout Redirector (H2-)
(function() {
var html_page = '/h2-login',
link_change = true,
redirect = true;
$(function() {
var regex = new RegExp(html_page);
// link change
if (link_change && !regex.test(window.location.href)) {
$('a[href^="/login"], a[href^="http://' + window.location.host + '/login"]').attr('href', html_page);
}
// redirect to classic if login page isn't available
if (!document.getElementById('fa_form_container') && regex.test(window.location.href)) {
window.location.href = '/login#login_classic';
}
});
// login redirection
// saves redirect location so you're taken to the correct page upon login
if (/\/login\?redirect/.test(window.location.href)) {
my_setcookie('fa_login_form_redirect', window.location.search.replace(/.*?redirect=(.*?)(?:&|$)/, '$1'));
}
// redirect
if (redirect && /\/login/.test(window.location.href)) {
if (/login_classic/.test(window.location.hash) || /admin=1/.test(window.location.href)) return;
window.location.href = html_page;
}
}());
// 2. Auto-close Side Panels After 3 Seconds
$(function() {
$('.module_column').on('mouseout', function() {
var t = this;
window[t.id + '-fadeout'] = window.setTimeout(function() {
var button = document.getElementById(/_panel/.test(t.id) ? t.id.replace(/_panel/, '_button').replace(/fae/, 'fa') : '') || $('.column_button_' + t.id)[0];
if (button) {
button.click();
}
}, 3000);
}).on('mouseover', function() {
window.clearTimeout(window[this.id + '-fadeout']);
});
});
// 3. Profile Preview
$(function() {
var links = $('a[href^="/u"]').filter(function() {
if (this.firstChild && this.firstChild.tagName) {
if (this.firstChild.tagName != 'IMG') {
return this;
}
} else {
return this;
}
}),
usersinfo = {};
links.tooltipster && links.not('.mentiontag, .tooltipstered').filter(function() {
if (!$(this).closest('#tabs')[0]) {
return this;
}
}).tooltipster({
animation: 'fade',
interactive: true,
contentAsHTML: true,
minWidth: 300,
maxWidth: 300,
delay: 500,
arrowColor: "#EEE",
autoClose: true,
content: 'Loading...',
functionBefore: function(origin, continueTooltip) {
continueTooltip();
var userid = $(this).attr('href').replace(/.*?\/u(\d+).*/, '$1');
if (origin.data('ajax') !== 'cached') {
if (usersinfo[userid] != undefined) {
origin.tooltipster('content', usersinfo[userid]).data('ajax', 'cached');
} else {
$.ajax({
type: 'GET',
url: "/ajax/index.php",
dataType: "html",
data: {
f: "m",
user_id: userid
},
success: function(html) {
usersinfo[userid] = html;
origin.tooltipster('content', html).data('ajax', 'cached');
}
});
}
}
}
});
});
// 4. Live Search
(function() {
'DEVELOPED BY ANGE TUTEUR';
'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
'ORIGIN : http://fmdesign.forumotion.com/t1118-live-search#26404';
window.fa_ajax_search = {
input_fields: 'input[name="search_keywords"]', // input elements you want to enable ajax searching on
delay: 100, // delay before sending search
// language settings
lang: {
title: 'Zoekresultaten',
searching: 'Bezig met het zoeken naar onderwerpen met "{KEYWORDS}"...',
no_results: 'Er werd niets gevonden "{KEYWORDS}"',
view_all: 'Toon alle resultaten',
close: 'Sluit'
},
// wait before sending the search
queue: function(caller) {
fa_ajax_search.clear(); // clear ongoing searches
fa_ajax_search.wait = window.setTimeout(function() {
fa_ajax_search.query(caller);
}, fa_ajax_search.delay);
},
// create the search result popup
createPopup: function(caller) {
if (!fa_ajax_search.popup) {
var popup = document.createElement('DIV');
popup.className = 'fa_ajax_search-results';
popup.innerHTML =
'<a href="javascript:fa_ajax_search.clear();" class="fa_ajax_search-close" title="' + fa_ajax_search.lang.close + '">X</a>' +
'<div class="fa_ajax_search-title">' + fa_ajax_search.lang.title + '</div>' +
'<ul class="fa_ajax_search-topics"></ul>' +
'<p style="text-align:center;">' +
'<a href="#" class="button1">' + fa_ajax_search.lang.view_all + '</a>' +
'</p>';
fa_ajax_search.popup = popup;
}
fa_ajax_search.popup.getElementsByTagName('UL')[0].innerHTML = '<li>' + fa_ajax_search.lang.searching.replace('{KEYWORDS}', caller.value) + '</li>';
fa_ajax_search.popup.lastChild.getElementsByTagName('A')[0].href = fa_ajax_search.url(caller);
caller.parentNode.appendChild(fa_ajax_search.popup);
},
// submit a search
query: function(caller) {
fa_ajax_search.createPopup(caller);
fa_ajax_search.request = $.get(fa_ajax_search.url(caller), function(d) {
fa_ajax_search.showResults(caller, $('.topictitle', d));
});
},
// create and return the search URL
url: function(caller) {
var form = $(caller).closest('form')[0],
where = form ? form.search_where : null;
return '/search?search_keywords=' + encodeURIComponent(caller.value) + '*' + (where ? '&search_where=' + where.value : '');
},
// show the results in the popup
showResults: function(caller, results) {
var i = 0,
j = results.length,
list = fa_ajax_search.popup.getElementsByTagName('UL')[0],
frag = document.createDocumentFragment(),
li;
if (j) {
for (; i < j; i++) {
li = document.createElement('LI');
results[i].href = results[i].href.replace(/%2A$/, '');
li.appendChild(results[i]);
frag.appendChild(li);
}
list.innerHTML = '';
list.appendChild(frag);
} else {
list.innerHTML = '<li>' + fa_ajax_search.lang.no_results.replace('{KEYWORDS}', caller.value) + '</li>';
}
},
// initialize the selected input(s)
init: function(node) {
$(node).keyup(function() {
if (this.value.length >= 3) {
fa_ajax_search.queue(this);
} else {
fa_ajax_search.clear();
}
}).attr('autocomplete', 'off');
},
// clear and abort ongoing searches
clear: function() {
if (fa_ajax_search.wait) {
window.clearTimeout(fa_ajax_search.wait);
delete fa_ajax_search.wait;
}
if (fa_ajax_search.request) {
fa_ajax_search.request.abort();
delete fa_ajax_search.request;
}
if (fa_ajax_search.popup && fa_ajax_search.popup.parentNode) {
fa_ajax_search.popup.parentNode.removeChild(fa_ajax_search.popup);
}
}
};
// search result styles
$('head').append(
'<style type="text/css">' +
'.fa_ajax_search-results {' +
'font-family:arial, verdana, sans-serif;' +
'font-size:12px;' +
'text-align:left;' +
'white-space:normal;' +
'background:#FFF;' +
'border:1px solid #CCC;' +
'box-shadow:0 6px 12px rgba(0, 0, 0, 0.175);' +
'margin-top:3px;' +
'position:absolute;' +
'z-index:1;' +
'}' +
'.fa_ajax_search-title {' +
'color:#FFF;' +
'background:#69C;' +
'font-size:16px;' +
'height:25px;' +
'line-height:25px;' +
'margin:-1px -1px 0 -1px;' +
'padding:0 40px 0 6px;' +
'}' +
'.fa_ajax_search-results a.fa_ajax_search-close {' +
'color:#FFF !important;' +
'background:none;' +
'display:block;' +
'position:absolute;' +
'top:-1px;' +
'right:-1px;' +
'text-align:center;' +
'text-decoration:none !important;' +
'font-size:18px;' +
'line-height:25px;' +
'height:25px;' +
'width:35px;' +
'margin:0 !important;' +
'padding:0 !important;' +
'}' +
'.fa_ajax_search-results a.fa_ajax_search-close:hover { background:#F33 !important; }' +
'.fa_ajax_search-results > p { padding:3px; }' +
'.fa_ajax_search-topics {' +
'width:100%;' +
'max-height:300px;' +
'overflow-y:auto;' +
'overflow-x:hidden;' +
'}' +
'.fa_ajax_search-topics {' +
'color:#333;' +
'border-top:1px solid #CCC;' +
'border-bottom:1px solid #CCC;' +
'padding:0 !important;' +
'}' +
'.fa_ajax_search-topics li {' +
'padding:3px;' +
'display:block !important;' +
'line-height:14px !important;' +
'}' +
'.fa_ajax_search-topics li:nth-child(even) { background:rgba(0, 0, 0, 0.05); }' +
'.fa_ajax_search-topics li:nth-child(odd) { background:rgba(0, 0, 0, 0.1); }' +
'.fa_ajax_search-topics a.topictitle, #ipbwrapper .fa_ajax_search-results > p > a {' +
'font-size:12px;' +
'font-weight:normal !important;' +
'padding:0 !important;' +
'background:none !important;' +
'}' +
'</style>'
);
// wait for the document to be ready before initializing
$(function() {
fa_ajax_search.init(fa_ajax_search.input_fields);
});
}());
// 5. Live Search Options
$(function() {
'DEVELOPED BY ANGE TUTEUR';
'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
'ORIGIN : http://fmdesign.forumotion.com/t493-search-bar-options#6588';
// language config
var lang = {
display_as: '<b>Zoekresultaten laten zien als : </b>',
posts: 'Berichten',
topics: 'Onderwerpen',
tags: '<b>Trefwoorden : </b>',
advanced: '<b>Geavanceerd Zoeken</b>',
options_title: 'Zoekopties'
},
// search options layout
settings = $(
'<div class="fa_search_options" style="display:none;">' +
'<img class="fa_search_arrow" src="https://i18.servimg.com/u/f18/18/21/41/30/arrow11.png" />' + // arrow
'<p>' + lang.display_as + '</p>' +
'<p>' +
'<input type="radio" name="show_results" value="topics" checked="true"/>' +
'<label onclick="this.previousSibling.checked = 1;">' + lang.topics + '</label>' +
"<br>" +
'<input type="radio" name="show_results" value="posts"/>' +
'<label onclick="this.previousSibling.checked = 1;">' + lang.posts + '</label>' +
'</p>' +
'<p>' +
'<label onclick="this.nextSibling.checked = this.nextSibling.checked ? 0 : 1;">' + lang.tags + '</label>' +
'<input type="checkbox" name="is_tag" value="tags"/>' +
'</p>' +
'<hr class="dashed"/>' +
'<p>' +
'<a href="/search">' + lang.advanced + '</a>' +
'</p>' +
'</div>'),
// search options toggler
cog = $('<a href="#" class="fa_search_cog" title="' + lang.options_title + '"><i class="fa fa-cog"></i></a>').click(function() {
var settings = this.nextSibling,
arrow = $('.fa_search_arrow', settings)[0];
settings.style.display = /none/.test(settings.style.display) ? 'block' : 'none'; // toggle options display
// popup position
if (!arrow.style.right) {
var width = this.getBoundingClientRect().width;
arrow.style.right = width + 'px';
settings.style.right = $(this).closest('form').find('input[type="submit"]')[0].getBoundingClientRect().width - width + 'px';
}
return false;
}),
search = $('form[action^="/search"]'), // all search forms
i = 0,
j = search.length,
frag;
// get fontawesome if unavailable
if (!$('link[href$="font-awesome.min.css"]')[0]) {
document.getElementsByTagName('HEAD')[0].insertAdjacentHTML('beforeend', '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" />');
}
for (; i < j; i++) {
var keywords = search[i].search_keywords;
if (keywords && search[i].name != 'searchform' && search[i].parentNode.id != 'search_menu') {
frag = document.createDocumentFragment();
frag.appendChild(cog.clone(true).attr('style', 'left:' + keywords.getBoundingClientRect().width + 'px;')[0]);
frag.appendChild(settings.clone()[0]);
search[i].className += ' fa_search_form';
keywords.onfocus = function() {
var settings = $(this).closest('form').find('.fa_search_options')[0];
if (!/none/.test(settings.style.display)) settings.style.display = 'none';
};
search[i].appendChild(frag);
}
}
});
document.write('<style type="text/css">.fa_search_form{position:relative;display:inline-block;}a.fa_search_cog{color:#999;font-size:16px;position:absolute;margin-top:-8px;margin-left:-8px;top:50%}.fa_search_cog:hover{color:#69C}.fa_search_options{color:#333;font-size:12px;font-family:arial,sans-serif;text-align:center;background:#FFF;border:1px solid #DDD;border-radius:3px;box-shadow:0 3px 9px rgba(0,0,0,.175);position:absolute;top:100%;margin-top:15px;right:0;z-index:1;padding:3px;width:175px}.fa_search_options .fa_search_arrow{position:absolute;top:-10px;right:30px}.fa_search_options p{font-size:12px;margin:3px 0}.fa_search_options label{padding:0 6px 0 3px;vertical-align:middle;cursor:pointer}.fa_search_form input[type="text"] {padding-right:18px !important}</style>');
// 6. @Mentions Show Avatar
(function() {
'DEVELOPED BY ANGE TUTEUR';
'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
'ORIGIN : http://fmdesign.forumotion.com/t399-display-the-user-avatar-before-mentions#3207';
window.faMentionAvatar = {
// position modifies the position of the avatar
// 0 = before mention
// 1 = after mention
position: 0,
cacheTime: 1 * 60 * 60 * 1000, // amount of time the avatar is cached ( 1 hour )
mentions: null, // mention node list
index: -1, // current index in the mentions array
// checks if the mention is valid and then gets the avatar
getter: function() {
var mention = faMentionAvatar.mentions[++faMentionAvatar.index],
storage = window.localStorage,
id;
if (mention) {
id = mention.href.replace(/.*?\/u/, '');
if (storage && storage['mentionAvatar_' + id] && storage['mentionAvatar_' + id + '_exp'] > +new Date - faMentionAvatar.cacheTime) {
var avatar = document.createElement('IMG');
avatar.className += ' mention-ava';
avatar.src = storage['mentionAvatar_' + id];
faMentionAvatar.position ? mention.appendChild(avatar) : mention.insertBefore(avatar, mention.firstChild);
faMentionAvatar.getter();
} else {
$.get('/ajax/index.php?f=m&user_id=' + id, function(d) {
var avatar = $('.tooltip-content > img', d)[0];
if (avatar) {
faMentionAvatar.position ? mention.appendChild(avatar) : mention.insertBefore(avatar, mention.firstChild);
if (storage) {
storage['mentionAvatar_' + id] = avatar.src;
storage['mentionAvatar_' + id + '_exp'] = +new Date;
}
}
faMentionAvatar.getter();
});
}
}
}
};
// write the stylesheet into the HEAD section
document.write('<style type="text/css">.mentiontag img { height:20px; width:20px; vertical-align:middle; border-radius:100px; background:#FFF; box-shadow:0px 1px 1px rgba(0, 0, 0, 0.3), 0px -0px 1px rgba(0, 0, 0, 0.3); margin:1px 3px; padding:1px; }</style>');
// statements that need execution when the document is ready
$(function() {
faMentionAvatar.mentions = $('.mentiontag');
faMentionAvatar.getter();
});
}());
// 7. @Mentions Auto-Suggest
!window.fa_mentionner && !/\/privmsg|\/profile\?mode=editprofile&page_profil=signature/.test(window.location.href) && $(function() {
$(function() {
'SCEDITOR @HANDLE AUTO-SUGGEST';
'DEVELOPED BY ANGE TUTEUR';
'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
'ORIGIN : http://fmdesign.forumotion.com/t943-auto-suggest-mentions-as-you-type#19157';
var container = $('.sceditor-container')[0],
text_editor = document.getElementById('text_editor_textarea'),
frame,
instance;
if (container && text_editor) {
frame = $('iframe', container);
instance = $(text_editor).sceditor('instance');
window.fa_mentionner = {
suggest_delay: 100, // delay before suggestions show up (100ms)
// language presets
lang: {
placeholder: 'Searching...',
not_found: 'User not found'
},
// colors of the suggestion popup
color: {
font: '#333',
hover_font: '#FFF',
error_font: '#F00',
background: '#FFF',
hover_background: '#69C',
border: '#CCC',
shadow: 'rgba(0, 0, 0, 0.176)'
},
// sceditor instance and rangeHelper
instance: instance,
rangeHelper: instance.getRangeHelper(),
// cached nodes for listening and modifications
frame: frame[0],
body: frame.contents().find('body')[0],
textarea: $('textarea', container)[0],
// faux textarea and suggestion list
faux_textarea: $('<div id="faux_text_editor" />')[0], // helps us mirror the cursor position in source mode
list: $('<div id="fa_mention_suggestions" style="position:absolute;" />')[0],
// version specific selectors
selectors: $('.bodyline')[0] ? ['a.gen[href^="/u"]', '.avatar.mini a'] : document.getElementById('ipbwrapper') ? ['.membername', '.mini-avatar'] : null,
// adjusts the scroll position of the faux textarea so the caret stays in line
adjustScroll: function() {
fa_mentionner.faux_textarea.scrollTop = fa_mentionner.textarea.scrollTop;
},
// updates the content in the faux textarea
updateFauxTextarea: function(active, key) {
if (key == 16) { // 16 = SHIFT
return; // return when specific keys are pressed
}
// clear suggestion queue when suggestions aren't active
if (active != true) {
fa_mentionner.clearSuggestions();
} else {
return; // return when interactive keys are pressed while suggesting ; up, down, enter
}
// use another method if in WYSIWYG mode
if (!fa_mentionner.instance.inSourceMode()) {
key != 32 ? fa_mentionner.searchWYSIWYG() : fa_mentionner.clearSuggestions();
return;
}
var val = fa_mentionner.instance.val(),
range = 0,
selection,
faux_caret,
username;
// get the position of the caret
if (document.selection) {
selection = document.selection.createRange();
selection.moveStart('character', -fa_mentionner.textarea.length);
range = selection.text.length;
} else if (fa_mentionner.textarea.selectionStart || fa_mentionner.textarea.selectionStart == 0) {
range = fa_mentionner.textarea.selectionStart;
}
// set the position of the caret
val = val.slice(0, range) + '{FAUX_CARET}' + val.slice(range, val.length);
// parse and sanitize the faux textarea content
$(fa_mentionner.faux_textarea).html(
val.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/@"(.*?)"|@(.*?)(?:\s|\r|\n|$)/g, function(M, $1, $2) {
var lastChar = M.substr(-1),
name = ($1 || $2 || '').replace(/\{FAUX_CARET\}|"/g, '');
return '<a href="#' + name + '">' + (/\s|\r|\n/.test(M) ? M.slice(0, M.length - 1) + '</a>' + lastChar : M + '</a>');
})
.replace(/\{FAUX_CARET\}/, '<span id="faux_caret" style="position:absolute;margin-left:-3px;">|</span>')
);
faux_caret = document.getElementById('faux_caret');
// mentions are parsed as <a>nchors, so when the faux caret is inside one we'll show some suggestions
if (faux_caret && faux_caret.parentNode.tagName == 'A') {
fa_mentionner.value = val;
fa_mentionner.delay = window.setTimeout(function() {
fa_mentionner.suggest(faux_caret.parentNode.href.replace(/.*?#(.*)/, '$1'), $(faux_caret).offset());
}, fa_mentionner.suggest_delay);
}
fa_mentionner.adjustScroll();
},
// search for active mentions in wysiwyg mode
searchWYSIWYG: function() {
var selected = fa_mentionner.rangeHelper.cloneSelected(),
mentions = selected.startContainer.data && selected.startContainer.data.match(/(@".*?")|(@.*?)(?:\s|\r|\n|$)/g),
offset,
offset_marker,
hit,
i;
console.log(mentions);
if (mentions && mentions[0]) {
// clean up whitespace
for (i in mentions) {
mentions[i] = mentions[i].replace(/\s$/g, '');
}
// search for the mention that's currently being modified
for (i in mentions) {
if (!fa_mentionner.wysiwyg_mentions || (mentions[i] != fa_mentionner.wysiwyg_mentions[i])) {
hit = true;
fa_mentionner.delay = window.setTimeout(function() {
fa_mentionner.rangeHelper.insertMarkers(); // insert markers to help get the caret offset
offset = $(fa_mentionner.frame).offset();
offset_marker = $('#sceditor-end-marker', fa_mentionner.body).show().offset();
// add the marker offsets to the iframe offsets
offset.left += offset_marker.left;
offset.top += offset_marker.top - fa_mentionner.body.scrollTop;
fa_mentionner.suggest(mentions[i].slice(1).replace(/^"|"$/g, ''), offset, true);
fa_mentionner.wysiwyg_active = mentions[i]; // save the active mention for later use in finish()
}, fa_mentionner.suggest_delay);
break;
}
}
// hide the suggestion list if there's no newly modified mentions
if (!hit) {
fa_mentionner.list.style.display = 'none';
fa_mentionner.focused = null;
}
fa_mentionner.wysiwyg_mentions = mentions; // update the list of mentions
}
},
// suggest a list of users based on the passed username
suggest: function(username, offset, wysiwyg) {
// insert the suggestion list to show that it's searching
fa_mentionner.list.innerHTML = '<span class="fam-info">' + fa_mentionner.lang.placeholder + '</span>';
$(fa_mentionner.list).css({
left: offset.left + 'px',
top: offset.top + 'px',
display: 'block',
overflowY: 'auto'
});
document.body.appendChild(fa_mentionner.list);
// send a query request to the memeberlist to find users who match the typed username
fa_mentionner.request = $.get('/memberlist?username=' + username, function(d) {
fa_mentionner.request = null;
var suggestion = $(fa_mentionner.selectors ? fa_mentionner.selectors[0] : '.avatar-mini a', d),
ava = fa_mentionner.selectors ? $(fa_mentionner.selectors[1], d) : null,
i = 0,
j = suggestion.length,
name;
fa_mentionner.list.innerHTML = '';
if (j) {
for (; i < j; i++) {
name = $(suggestion[i]).text().replace(/^\s+|\s+$/g, '');
fa_mentionner.list.insertAdjacentHTML('beforeend',
'<a href="javascript:fa_mentionner.finish(\'' + name.replace(/'/g, '\\\'') + '\', ' + wysiwyg + ');" class="fa_mention_suggestion">' +
'<img class="fa_suggested_avatar" src="' + $(fa_mentionner.selectors ? ava[i] : suggestion[i]).find('img').attr('src') + '"/>' +
'<span class="fa_suggested_name">' + name + '</span>' +
'</a>'
);
}
// change overflowY property when it exceeds 7 suggestions -- prevents unsightly scroll bug
fa_mentionner.list.style.overflowY = j > 7 ? 'scroll' : 'auto';
// update the focused suggestion and scroll it into view
fa_mentionner.list.firstChild.className += ' fam-focus';
fa_mentionner.focused = fa_mentionner.list.firstChild;
fa_mentionner.scrollSuggestions();
} else {
fa_mentionner.list.innerHTML = '<span class="fam-info" style="color:' + fa_mentionner.color.error_font + ';">' + fa_mentionner.lang.not_found + '</span>';
}
});
},
// kill the suggestion timeout while typing persists
clearSuggestions: function() {
if (fa_mentionner.delay) {
window.clearTimeout(fa_mentionner.delay);
fa_mentionner.delay = null;
fa_mentionner.list.style.display = 'none';
fa_mentionner.focused = null;
}
if (fa_mentionner.request) {
fa_mentionner.request.abort();
fa_mentionner.request = null;
}
},
// finish the username
finish: function(username, wysiwyg) {
var mention, index, i;
// hide and clear suggestions
fa_mentionner.clearSuggestions();
fa_mentionner.focused = null;
fa_mentionner.list.style.display = 'none';
if (!wysiwyg) {
fa_mentionner.value = fa_mentionner.value.replace(/(?:@".[^"]*?\{FAUX_CARET\}.*?"|@\{FAUX_CARET\}.*?(\s|\n|\r|$)|@.[^"\s]*?\{FAUX_CARET\}.*?(\s|\n|\r|$))/, function(M, $1, $2) {
mention = '@"' + username + '"';
return '{MENTION_POSITION}' + ($1 ? $1 : $2 ? $2 : '');
});
// get the index where the mention should be
index = fa_mentionner.value.indexOf('{MENTION_POSITION}');
fa_mentionner.value = fa_mentionner.value.replace('{MENTION_POSITION}', '');
// save current scroll position for application after the value has been updated
fa_mentionner.scrollIndex = fa_mentionner.textarea.scrollTop;
// update the textarea with the completed mention
fa_mentionner.instance.val('');
fa_mentionner.instance.insert(fa_mentionner.value.slice(0, index) + mention, fa_mentionner.value.slice(index, fa_mentionner.value.length));
// restore the scroll position for the textareas
fa_mentionner.textarea.scrollTop = fa_mentionner.scrollIndex;
fa_mentionner.adjustScroll();
// update the fake textarea
fa_mentionner.updateFauxTextarea();
} else {
// save the caret range in WYSIWYG so we can restore it after replacing the HTML
fa_mentionner.rangeHelper.saveRange();
fa_mentionner.body.innerHTML = fa_mentionner.body.innerHTML.replace(new RegExp(fa_mentionner.wysiwyg_active.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + '(<span.*?id="sceditor-end-marker".*?>)'), '@"' + username + '"$1');
fa_mentionner.body.focus();
fa_mentionner.rangeHelper.restoreRange();
// update the wysiwyg mention array so no new suggestions appear
for (i in fa_mentionner.wysiwyg_mentions) {
if (fa_mentionner.wysiwyg_mentions[i] == fa_mentionner.wysiwyg_active) {
fa_mentionner.wysiwyg_mentions[i] = '@"' + username + '"';
break;
}
}
}
},
// scroll the selected suggestion into view
scrollSuggestions: function() {
$(fa_mentionner.list).scrollTop(
(
$(fa_mentionner.focused).offset().top -
$(fa_mentionner.list).offset().top +
$(fa_mentionner.list).scrollTop()
) -
(26 * 3) // 26 = the height of the suggestions, so display 3 suggestions above while scrolling
);
}
};
// get computed styles for the textarea and apply them to the faux textarea
for (var css = window.getComputedStyle(fa_mentionner.textarea, null), i = 0, j = css.length, str = ''; i < j; i++) {
str += css[i] + ':' + css.getPropertyValue(css[i]) + ';';
}
// add styles to the head
$('head').append('<style type="text/css">' +
'#faux_text_editor {' + str + '}' +
'#faux_text_editor { position:absolute; left:0; bottom:0; z-index:-1; visibility:hidden; display:block; overflow-y:auto; }' +
'#fa_mention_suggestions { color:' + fa_mentionner.color.font + '; font-size:10px; font-family:arial, verdana, sans-serif; background:' + fa_mentionner.color.background + '; border:1px solid ' + fa_mentionner.color.border + '; margin-top:20px; z-index:999; max-height:182px; overflow-x:hidden; box-shadow:0 6px 12px ' + fa_mentionner.color.shadow + '; }' +
'a.fa_mention_suggestion, .fam-info { color:' + fa_mentionner.color.font + '; height:26px; line-height:26px; padding:0 3px; display:block; white-space:nowrap; cursor:pointer; }' +
'a.fa_mention_suggestion.fam-focus { color:' + fa_mentionner.color.hover_font + '; background:' + fa_mentionner.color.hover_background + '; }' +
'.fa_suggested_avatar { height:20px; width:20px; vertical-align:middle; margin-right:3px; }' +
'</style>');
// insert faux textarea into document
fa_mentionner.textarea.parentNode.insertBefore(fa_mentionner.faux_textarea, fa_mentionner.textarea);
// apply event handlers
fa_mentionner.textarea.onclick = fa_mentionner.updateFauxTextarea;
fa_mentionner.textarea.onscroll = fa_mentionner.adjustScroll;
// update the faux textarea on keyup
fa_mentionner.instance.keyUp(function(e) {
if (fa_mentionner.focused && e && (e.keyCode == 13 || e.keyCode == 38 || e.keyCode == 40)) {
fa_mentionner.updateFauxTextarea(true, e.keyCode);
return false;
} else {
fa_mentionner.updateFauxTextarea(false, e.keyCode);
}
});
// key events for the suggested mentions
$([document, fa_mentionner.body]).on('keydown', function(e) {
var that = e.target;
if (fa_mentionner.focused && e && e.keyCode && (that.tagName == 'TEXTAREA' || that.tagName == 'BODY')) {
// move selection down
if (e.keyCode == 40) {
var next = fa_mentionner.focused.nextSibling;
if (next) {
$(fa_mentionner.focused).removeClass('fam-focus');
next.className += ' fam-focus';
fa_mentionner.focused = next;
fa_mentionner.scrollSuggestions();
}
return false;
}
// move selection up
if (e.keyCode == 38) {
var prev = fa_mentionner.focused.previousSibling;
if (prev) {
$(fa_mentionner.focused).removeClass('fam-focus');
prev.className += ' fam-focus';
fa_mentionner.focused = prev;
fa_mentionner.scrollSuggestions();
}
return false;
}
// apply selection
if (e.keyCode == 13) {
fa_mentionner.focused.click();
return false;
}
}
});
// update focused suggestion on hover
$(document).on('mouseover', function(e) {
var that = e.target;
if (/fa_mention_suggestion/.test(that.className)) {
$(fa_mentionner.focused).removeClass('fam-focus');
that.className += ' fam-focus';
fa_mentionner.focused = that;
}
});
}
})
});
// 8. @Mentions ALL
$(function() {
if (_userdata.user_level == 1 && $.sceditor && toolbar) {
var tagAll = function() {
var editor = this;
$.get('/search?mode=searchuser&fieldname=username&search_username=*', function(d) {
for (var a = $('option', d), i = 0, j = a.length, str = ''; i < j; i++) {
str += '@"' + $(a[i]).text() + '" ';
}
editor.insertText('[table class="tag-all"][tr][td]' + str + '[/td][/tr][/table]');
});
};
$.sceditor.command.set('tagall', {
exec: tagAll,
txtExec: tagAll,
tooltip: 'Tag all members'
});
toolbar += '|tagall';
}
'par ange tuteur';
});
document.write('<style>.tag-all { font-size:0; } .tag-all, .tag-all * { display:inline; } .tag-all:before { content:"@Iedereen"; font-color: red; font-size:12px; } .tag-all * { display:none; }</style>');
// 9. Memberlist Alphabet Bar
if (/\/memberlist/.test(window.location.href)) {
'DEVELOPED BY ANGE TUTEUR';
'NO DISTRIBUTION WITHOUT CONSENT OF THE AUTHOR';
'ORIGIN : http://fmdesign.forumotion.com/t479-alphabet-search-bar-for-the-memberlist#5995';
$(function() {
window.fa_alphabar = {
// position of the bar ; 'top', 'left', 'bottom', or 'right'
position: 'top',
presets: ['Alles', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '!', '?', '#', '$', '_', '(', ')', '+', '-', '.', '[', ']', '<', '>'],
bar: $('<div id="memberlist_alphabar" />')[0], // creates the preset bar
list: $('form[action="/memberlist"]')[0].nextSibling, // memberlist
// sort the memberlist by the letter that was chosen
change: function(that) {
if (that.id != 'alphabar_actif') {
var actif = document.getElementById('alphabar_actif');
if (actif) actif.id = '';
that.id = 'alphabar_actif';
$.get(that.href, function(d) {
fa_alphabar.list.parentNode.innerHTML = $('form[action="/memberlist"]', d).parent().html();
fa_alphabar.list = $('form[action="/memberlist"]')[0].nextSibling;
if (document.getElementById('ipbwrapper')) fa_alphabar.list = fa_alphabar.list.nextSibling;
fa_alphabar.insertBar();
});
}
},
// inserts the preset bar
insertBar: function() {
fa_alphabar.bar.className = 'alphabar_' + fa_alphabar.position;
fa_alphabar.list.className += ' alphalist_' + fa_alphabar.position;
fa_alphabar.list.parentNode.insertBefore(fa_alphabar.bar, fa_alphabar.position.toLowerCase() == 'bottom' ? fa_alphabar.list.nextSibling : fa_alphabar.list);
/left|right/i.test(fa_alphabar.position) && fa_alphabar.list.insertAdjacentHTML('afterend', '<div class="clear"></div>'); // clear floats for left and right positions
}
};
if (fa_alphabar.list) {
// put together the alphabar
for (var i = 0, j = fa_alphabar.presets.length, newRow = /left|right/i.test(fa_alphabar.position), htmlStr = '<table><tbody>' + (newRow ? '' : '<tr>'); i < j; i++) {
htmlStr += (newRow ? '<tr>' : '') + '<td><a href="/memberlist' + (i == 0 ? '" id="alphabar_actif' : '?mode=lastvisit&order=DESC&submit=Ok&username=' + fa_alphabar.presets[i]) + '" ' + (new RegExp('username=' + fa_alphabar.presets[i].replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + '(?:$|&)').test(window.location.search) ? 'id="alphabar_actif"' : '') + ' onclick="fa_alphabar.change(this); return false;">' + fa_alphabar.presets[i] + '</a></td>' + (newRow ? '</tr>' : '');
}
fa_alphabar.bar.innerHTML = htmlStr + (newRow ? '' : '</tr>') + '</tbody></table>';
if (document.getElementById('ipbwrapper')) fa_alphabar.list = fa_alphabar.list.nextSibling;
fa_alphabar.insertBar();
}
});
document.write('<style type="text/css">#memberlist_alphabar table{font-size:24px;line-height:30px;font-family:arial,sans-serif;text-align:center;background:#CCC;border-spacing:1px;margin:10px 0;width:100%}#memberlist_alphabar td{width:20px;background:#EEE}#memberlist_alphabar a{text-decoration:none!important}a#alphabar_actif{color:inherit}.alphabar_left,.alphabar_right{width:3%;margin:1%}.alphalist_left,.alphalist_right{clear:none;width:90%;margin:1%}.alphabar_left{float:left}.alphabar_right,.alphalist_left{float:right}.alphalist_right{float:left}</style>');
}
// 10. Back to Top Arrow
$(document).ready(function() {
jQuery('body').append('<a href="#" title="Terug naar boven" class="scrollToTop" style="position:fixed; bottom:55px; right:20px; display:none;"><img src="http://icons.iconarchive.com/icons/custom-icon-design/pretty-office-5/48/navigate-up-icon.png" /></a>');
//Check to see if the window is top if not then display button
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.scrollToTop').fadeIn();
} else {
$('.scrollToTop').fadeOut();
}
});
//Click event to scroll to top
$('.scrollToTop').click(function() {
$('html, body').animate({
scrollTop: 0
}, 1000);
return false;
});
});
// 11. Hide Profile Title :: Symbols
/\/u\d+/.test(window.location.href) && $(function() {
var title = $('.page-title')[0];
if (title) {
title.innerHTML = title.innerHTML.replace(/:/g, '');
}
});
// 12. Smiley Meanings
(function() {
if (window.sessionStorage && window.JSON) {
var addTitles = function() {
$(function() {
for (var a = $('.post img'), i = 0, j = a.length; i < j; i++) {
if (smilies_data[a[i].src]) {
a[i].title = smilies_data[a[i].src];
}
}
});
};
if (!window.smilies_data && sessionStorage.smilies_data) {
window.smilies_data = JSON.parse(sessionStorage.smilies_data);
addTitles();
} else {
$.get('/smilies.forum?action=smilies&js=no&mode=smilies_frame', function(d) {
window.smilies_data = {};
for (var a = $('img', d), i = 0, j = a.length; i < j; i++) {
smilies_data[a[i].src] = a[i].title;
}
sessionStorage.smilies_data = JSON.stringify(window.smilies_data);
addTitles();
});
}
}
'par ange tuteur';
}());
// 13. SCEditor Image Button Combine
$(function() {
if ($.sceditor) {
$(function() {
window.fa_servimg_upload = function() {
var win = window.open('https://servimg.com/', '_blank', 'width=620,height=300');
$.get('/privmsg?mode=post', function(d) {
var email = d.match(/var servImgAccount = '(.*?)';/i),
id = d.match(/var servImgId = '(.*?)';/i),
f = d.match(/var servImgF = '(.*?)';/i);
if (email && id && f && email[1] && id[1] && f[1]) {
win.location.href = 'https://servimg.com/multiupload.php?&mode=fae&account=' + email[1] + '&id=' + id[1] + '&f=' + f[1];
}
});
};
$('.sceditor-button-servimg').hide();
$('.sceditor-button-image').click(function() {
$('.sceditor-insertimage div:last-child').append(
$('<input type="button" class="button" value="Upload">').click(fa_servimg_upload)
);
});
});
}
'par ange tuteur';
});
// 14. Add Code Snippet Button (Admins Only)
$(function() {
if ($.sceditor && _userdata.user_level == 1) {
$.sceditor.command.set('inline-code', {
exec: function() {
this.insert('[table class="inline-code"][tr][td][code]', '[/code][/td][/tr][/table]');
},
txtExec: function() {
this.insert('[table class="inline-code"][tr][td][code]', '[/code][/td][/tr][/table]');
},
tooltip: 'Code snippet'
});
toolbar = toolbar.replace(/code/, 'code,inline-code');
}
});
document.write('<style type="text/css">.inline-code,.inline-code *{display:inline-block!important}.inline-code .codebox{background-color:rgba(0,0,0,.04)!important;border:1px solid rgba(0,0,0,.05)!important;margin:0;line-height:12px;border-radius:3px}#mpage-body .inline-code .codebox p,.inline-code .codebox dt{display:none!important}.inline-code .codebox code{padding:0!important;margin:0;border:none;background:0 0}.sceditor-button-inline-code div{background-image:url(http://i21.servimg.com/u/f21/18/21/41/30/snippe10.png)!important}</style>');
Soortgelijke onderwerpen
Registreer of log in om te kunnen reageren
U dient een geregistreerd lid te zijn om te kunnen reageren.
Pagina 1 van 1
Permissies van dit forum:
Je mag geen reacties plaatsen in dit subforum