Skip to content

Commit

Permalink
some changes - mainly new history layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel 'lord_T' Maruszczyk committed Jun 25, 2012
1 parent 552dc9f commit 3e8bcff
Showing 1 changed file with 92 additions and 11 deletions.
103 changes: 92 additions & 11 deletions redmineboost.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

//============================================================================================

var ver = 'redminebooster.version.20';
var ver = 'redminebooster.version.21';

//== local GM storage 4 chrm
if (typeof GM_deleteValue == 'undefined') {
Expand Down Expand Up @@ -43,6 +43,7 @@ var subtaskAsCtrlN = getStoredValue('sns', true);
var subtaskCollpsd = getStoredValue('ssc', false);
var timeLogsRemovd = getStoredValue('tlr', true);
var savingComEdits = getStoredValue('sce', false);
var newHistFotrmat = getStoredValue('nhf', true);


//functions
Expand Down Expand Up @@ -73,6 +74,10 @@ function MD5(s) {function L(b,a){return(b<<a)|(b>>>(32-a))}function K(k,b){var F

function getCsgMail(name, name1st) {

if (name.indexOf('@') > -1) {
return name;
}

var n = name;
if (!name1st) {
n = n.split(' ').reverse().join(' ');
Expand Down Expand Up @@ -189,6 +194,28 @@ try {
v += '#header{position: fixed !important; top:1.6em;width:99%;border-bottom:6px solid #eee;} ';
}

if (newHistFotrmat) {
v += '#history h4{width:230px; float:left; margin:0; padding:0;}';
v += '#history .journal{margin:0; padding:0; }';
v += '#history .details{width:auto; margin:0; padding:0 0 0 240px;}';
v += '#history h4 img.gravatar{border:#eee solid; border-width:0 1px 1px 1px; margin:0 0 1px; float:left;}';
v += '#history h4 .rmHistoryDiv{ float:left; margin-left:7px; width: 146px;}';
v += '#history h4 .rmHistoryDiv .rmDate{color:#444;} #history h4 div .rmDate:hover{color:#C61A1A;}';
v += '#history h4 a.journal-link{float:right;color:white;} #history div:hover h4 a.journal-link:hover{color:#C61A1A;}';
v += '#history > div.rmHistoryDivOdd h4 a.journal-link{color:#eee;}';
v += '#history div:hover h4 a.journal-link{color:#2A5685;}';
v += '#history > div:hover,#history > div.rmHistoryDivOdd:hover {background:#ddd; }';
v += '#history p {padding-left: 225px; margin-bottom:0; margin-top:0; padding-bottom:12px;}';
v += '#history > div{min-height:36px; border-top:1px solid #eee;}';
v += '#history > div.rmHistoryShort{border-top:0;}';
v += '#history > div.rmHistoryDivOdd{background:#eee;}';
v += '#history .rmHistoryShort h4 img{height:28px; opacity:0.5;margin: 0 2px; border:0;}';
v += '#history .rmHistoryShort .rmArchiver{display:none;}';
v += '#history div.wiki pre{margin-left:225px;}';
v += '#history blockquote{margin-left: 250px;} #history div.rmHistoryDivOdd blockquote,#history > div:hover blockquote{border-color:#bbb;}';
v += '#history blockquote blockquote{margin-left:10px;} #history blockquote p {padding-left:10px;}';
}

v += '</style>';
s.innerHTML = v;

Expand Down Expand Up @@ -569,13 +596,16 @@ try{

function select2button(selectIDDD, avatars) {

try{

////
var swch = createElement('span'),
//-userid = getById('loggedas').getElementsByTagName('a')[0].href.split('/'),
userid = getById('loggedas').getElementsByTagName('a')[0].innerHTML.split('.').reverse().join(' '),
userid = getById('loggedas').getElementsByTagName('a')[0].innerHTML,
selme = getById(selectIDDD),
GM_key = selectIDDD + '_gm_key';

} catch (e) {console.log(e);}

allButtonsGlob[selectIDDD] = GM_getValue(GM_key);

//switcher
Expand Down Expand Up @@ -642,7 +672,7 @@ try{
if (optVal.match(/<</)) {
optVal = userid;
}

el.className = 'asi';
el.style.cssText = 'background-image:url(' + getGravatar( getCsgMail(optVal, nameFirst) ) + ')';

Expand Down Expand Up @@ -806,7 +836,7 @@ try {

}

//test dev wait
//suspended status
var status = document.getElementsByTagName('td'),
cs = status.length;

Expand All @@ -815,7 +845,7 @@ try {
var parentQth = status[q].parentNode.getElementsByTagName('th');
if (status[q].className == 'status' && parentQth.length) {

if (status[q].innerHTML.match(/.*(test dev wait).*/i) ) {
if (status[q].innerHTML.match(/.*(suspended).*/i) ) {

isTestDevWait = true;
break;
Expand All @@ -832,7 +862,7 @@ try {
h2.className = 'rmH2Improved';
h2.appendChild(dp);
dp.className = 'rmTestDevWait';
dp.innerHTML = 'TEST DEV WAIT';
dp.innerHTML = 'SUSPENDED';

}

Expand Down Expand Up @@ -1138,6 +1168,56 @@ try{

} catch (e) {console.log('hiding time logging', e);}

//improved history log
try{

if (newHistFotrmat) {

var hist = getById('history'),
h4s = hist.getElementsByTagName('h4'),
imgs = hist.getElementsByTagName('img'),
as, dva, lastMan, curMan;

for (var i = 0, ci = imgs.length; i < ci; ++i) {

if (h4s[i]) {

h4s[i].innerHTML = h4s[i].innerHTML.replace(/Updated by|Uaktualnione przez/i, '');

dva = createElement('div');
dva.className = 'rmHistoryDiv';
as = h4s[i].getElementsByTagName('a');

curMan = as[as.length - 2].innerHTML;
if (lastMan == curMan) {
h4s[i].parentNode.className += ' rmHistoryShort '+ (i%2? 'rmHistoryDivOdd': '');
} else {
lastMan = curMan;
}
h4s[i].parentNode.className += (i%2? ' rmHistoryDivOdd': '');

as[as.length - 1].className = 'rmDate';
as[as.length - 2].className = 'rmArchiver';

dva.appendChild(as[as.length - 2]);
dva.lastChild.appendChild(createElement('br'));
dva.appendChild(as[as.length - 1]);
dva.appendChild(as[as.length - 1]);
dva.appendChild(h4s[i].lastChild);
dva.appendChild(as[as.length - 1]);

h4s[i].appendChild(dva);

}

imgs[i].src = imgs[i].src.replace('&size=24', '&size=30');

}

}

} catch (e) {console.log('improved history log', e);}

//script panel
try {

Expand Down Expand Up @@ -1188,9 +1268,10 @@ try {
{setName: 'sma', description: 'Use medium avatars in list', defau:false},
{setName: 'sfn', description: 'Full name in tasks` list', defau:false},
{setName: 'sns', description: 'New subtask by CTRL+N', defau:true},
{setName: 'ssc', description: 'Subtasks collapsed by default', defau:false, nevv: true},
{setName: 'tlr', description: 'Remove time logs in edit', defau:true, nevv: true},
{setName: 'sce', description: 'CTRL+S with comments edits (see /1)', defau:false, nevv: true},
{setName: 'ssc', description: 'Subtasks collapsed by default', defau:false},
{setName: 'tlr', description: 'Remove time logs in edit', defau:true},
{setName: 'sce', description: 'CTRL+S with comments edits (see /1)', defau:false},
{setName: 'nhf', description: 'Short & fancy history layout', defau:true, nevv: true},
{description: '[save button]'},
{description: ''},
{description: '* * Other features * * *'},
Expand All @@ -1203,7 +1284,7 @@ try {
{description: 'Selects to buttons option'},
{description: 'Sorting by polish in Assignee'},
{description: 'Fancy information about blocking & duplicates'},
{description: 'Fancy information about test dev wait status', nevv: true},
{description: 'Fancy information about suspended status', nevv: true},
{description: 'Avatars in tasks lists'},
{description: 'Thumbnails of images'},
{description: 'Checking availability of new versions'},
Expand Down

0 comments on commit 3e8bcff

Please sign in to comment.