A Answer 1B Answer 2
A Answer 3A Answer 1B Answer 2
previous answers above, scroll upwards to read them
B Answer 2
previous answers above, scroll upwards to read them
A Answer 3
$("#content").append('\
<style>\
.hidden-post{\
height: 6px;\
overflow: hidden;\
}\
.forum-threadview-post-text blockquote blockquote{\
cursor: pointer;\
}\
</style>\
');
$( ".forum-threadview-post-content .forum-threadview-post-text" ).each(function( index ) {
if( $(this).find('blockquote').length && $(this).find('blockquote blockquote').length){
$(this).find('blockquote blockquote').attr("class", "hidden-post");
$(this).find('blockquote blockquote')[0].addEventListener('click', function(){
if( $( this ).attr("class") && $( this ).attr("class").match("hidden-post") ){
$( this ).removeClass("hidden-post");
}else{
$( this ).addClass("hidden-post");
}
}, true);
}
});
Edit it to improve it... GreatApo wrote:This is not so easy... and it will take some resourses...
It would be better if the same rule is applied every time without the need of searching the previous posts.
GreatApo wrote:This is not so easy... and it will take some resourses...
It would be better if the same rule is applied every time without the need of searching the previous posts.
ex. Read more button for all quotes exept the last one.
EDIT:
Go to a topic with quotes in quotes...
Chrome: Press F12, go to console, paste the code and press ENTER.
Edit it to improve it...
You are right. I wrote this as a first step. This can be improved with your ideas and with hide/show JQuery animations.ORFK wrote:i know.. its not easy, but its possible. the question is, how many time brain wants to spend ;-) your idea is good for a beginning, maybe after the release we will get a lot of feedbacks by different users from different counties :-)
This is javascript (with JQuery library).zeharti wrote:Hey,I'm just curious which language script is that.
I'm learning programming,never saw such code :)
// Lets extend the page Css
$('head').append('<style>\
.forum-threadview-post-text>blockquote{\
width: 97%;\
max-height: 200px;\
overflow-y: auto;\
}\
</style>');
// For each top blockquote
$('.forum-threadview-post-text>blockquote').each(function(){
$(this).scrollTop($(this)[0].scrollHeight);
});
// Lets extend the page Css
$('head').append('<style>\
.forum-threadview-post-text>blockquote{\
width: 97%;\
max-height: 200px;\
overflow-y: auto;\
}\
.forum-threadview-post-text blockquote>em{\
color: #EEE;\
}\
.forum-threadview-post-text blockquote>.quote-num{\
float: right;\
font-size: 11px;\
color: #eee;\
}\
.forum-threadview-post-text blockquote>blockquote {\
background-color: transparent !important;\
border-top: 0px !important;\
border-left: 0px !important;\
border-right: 0px !important;\
padding: 0px 0px 10px 0px !important;\
}\
.forum-threadview-post-text blockquote.multiquote {\
background-color: rgba(0, 0, 0, 0.3) !important;\
border: 1px solid rgba(167, 167, 167, 0.3) !important;\
padding: 10px !important;\
}\
.forum-threadview-post-text blockquote .quotespot{\
font-style: italic;\
font-size: 10px;\
color: #ccc;\
}\
</style>');
// The recursive patcher
var quotePatcher = function(blockquote, number, data){
// New node
data.length++;
// Insert the namediv of the quote
$(blockquote).prepend('<div class="quote-num"></div>');
// Get his children quotes
var children = $(blockquote).children("blockquote");
// Clone name number
var children_number = number.slice(0);
// For every quote child
$(blockquote).children("blockquote").each(function(){
// New child
children_number[children_number.length-1]++;
// If not the only child
if(children.length>1){
// Set quote as multy quote
$(this).addClass('multiquote');
// Clone again number
var new_children_number = children_number.slice(0);
// Extend number
new_children_number.push(1);
// patch
quotePatcher(this, new_children_number, data);
// If the only one
} else {
// patch
quotePatcher(this, children_number, data);
}
});
// If the last quote
if(number.length==1 && number[0]==1){
// if not the only one
if(data.length!=1){
// Show name
$(blockquote).children('.quote-num').text('Quote last');
// Scroll to last quote
quoteScrollTo($(blockquote), $(blockquote).children('.quote-num'));
}
return;
}
// Insert name
$(blockquote).children('.quote-num').text('Quote '+number.join('.'));
// Leave a quote name on the spot found
$('<div class="quotespot">[Quote '+number.join('.')+']</div>').insertAfter(blockquote);
// Move it on top
$(blockquote).parent().prepend(blockquote);
};
var quoteScrollTo = function(container, scrollTo){
// Scroll to
container.scrollTop(
scrollTo.offset().top - container.offset().top + container.scrollTop()
);
}
// For each top blockquote
$('.forum-threadview-post-text>blockquote').each(function(){
// Create a pointer to length
var data = {length:0};
// Start recursive
quotePatcher(this, [1], data);
});
zeharti wrote:Many thanks guys!!!
Tested out and is amazin'.
BTW is it final version or just pre-alpha build?