MDM HTML5 Themes

Submit your artwork to make Linux Mint look better
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
hb1547

Re: MDM HTML5 Themes

Post by hb1547 »

I made another login theme today -- this one's a Matrix-style login one:
screen_full.jpg
You can get it at [url]http://xatal.com/matrix.tar.gz[/url] (v0.1)

This one is more convoluted than before, so again, no guarantees about how well this will work. But if you have problems, suggestions, or any of that I'd love your feedback.

Some features:
- Has falling-down Matrix-style green text
- In the center is a simple USERNAME field, which changes to password. No selection of users in this theme. The word "username" appears as if typed.
- The white "+" on the bottom-left brings up the options for shutdown, restart, languages, sessions, etc.

I've been testing on my 5 year old laptop and performance seems good enough, but if you find it a little slow (or want some more control over appearance), here are some quick changes you can make. Just open "index.html" and hunt around for these lines, they're all near the top:

Code: Select all

var cellSize = 17;
This is the size of each letter, basically. The larger this number, the larger the letters and the fewer you'll have. This will greatly improve performance and initial load time. Decreasing this may look better, but at the expense of performance.

Code: Select all

var updateRate = 70;
The number of ms between each shift of the falling-text effect. Lower numbers will make the animation faster/smoother, but again at the expense of performance.

Code: Select all

var typeSpeed = 150;
The speed at which the typed text appears. Higher numbers will appear more slowly, and lower will appear faster. Setting it to 0 will make it appear instantly.
anandrkris

Re: MDM HTML5 Themes

Post by anandrkris »

Great. Will try it out. In fact, I had posted this idea a while ago when HTML5 themes were introduced.
http://forums.linuxmint.com/viewtopic.php?f=25&t=126979&p=695888#p695888
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

I did start one for the matrix because asked awhile back, and it looked great in the emulator but it froze at the login-screen for me so I put mine on hold, glad to see someone got it going :D onto other things for me, this one good, no need to make another one, which I'm glad because mine never worked out anyhow.
Good to see and to see others joining in and making these, it's a great thing to see.
Sam
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

I need help, and not in the mental way, it's too late for that part :lol:
My javascript is lacking and I didn't really start digging into it until I started making these themes, other then that it's been years since I dabbled into it.
I used the clouds mousetrap and it worked great for users that used more then 1 row like so
mutlirows.jpg
What I need now for the other half of my themes is to get this to work with 1 row only and multi cells inserted into that one row as such
onerow.jpg
I been fooling around with quite a few way to do it but so far no success, I can do it without the mousetrap stuff but no go with it because it uses a table and rows, I tried changing the rows, setting the rows to 1 and adding cells count instead but my lack of knowledge is not allowing it to happen.

Here is the original rows code by Clem clouds

Code: Select all

var table = document.getElementById("users");
 
            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
          	row.username = username;          	
 
            var cell1 = row.insertCell(0);           
            cell1.width = "64px";
            cell1.appendChild(link1);                   			

            var cell2 = row.insertCell(1);           
            cell2.appendChild(link2); 
as you can see it adds rows and inserts a cell into each row, what I need is to have one row and insert multi cells into that one row instead.
I'm trying to get this done but it's not working.
Any help would be greatly appreciated.
Sam
hb1547

Re: MDM HTML5 Themes

Post by hb1547 »

Have a row with an Id. Then for each new user, create a td and append it to the row. I'd type up some code but I'm on my phone.
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

Not quite sure I understand it but I'll keep looking into it.
Thanks
hb1547

Re: MDM HTML5 Themes

Post by hb1547 »

I might not be understanding your problem entirely, and I'm also not entirely familiar with mousetrap. It sounds like you're trying to just add one cell per user to the table row, rather than add a new row for each user. So, in the main index.html file, between the body tags, you'll want something like:

Code: Select all

<table id='user_table'>
<tr id='user_row'>
</tr>
</table>


Then, your mdm_add_user function might look something like:

Code: Select all


var cellID = 1;

function mdm_add_user() {

var tr = document.getElementById('user_row');

var user_cell = document.createElement('td');
user_cell.id = 'user-' + cellID;
cellID++;

var user_pic = document.createElement('img');
user_pic.src = <LOCATION OF USER PIC>;

var user_name = document.createElement('div');
user_name.appendChild(document.createTextNode(<USERNAME VARIABLE>));
user_name.setAttribute('class', 'user_name');

var user_status = document.createElement('div');
user_status.appendChild(document.createTextNode(userstatus));
user_status.setAttribute('class', 'user_status');

user_cell.appendChild(user_pic);
user_cell.appendChild(user_name);
user_cell.appendChild(user_status);
}

So the idea is that cellID contains the current user's index, and it becomes the ID of the cell (with 'user-' in front). Then you would cycle through those.
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

Looks good I'll give it a whirl.
Maybe I can mix and match with mousetrap.
mousetrap allows you to use a shortcut to activate a button or whatever you want it to, I like it just couldn't figure out how to get one row and cells into it.

Here is the full code I used from clouds for the other ones.

The html part

Code: Select all

<div id="table-wrapper">
  			<div id="table-scroll">
    			<table class="table-condensed" id="users">       
    			</table>
  			</div>
		</div>
The mousetrap part

Code: Select all

<script>
init();
	Mousetrap.bind('up', function() {		
    	select_user(selected_row - 1);
	});

	Mousetrap.bind('down', function() {
    	select_user(selected_row + 1);
	});</script>
so it scrolls through the users using the up and down arrows, nice and easy.

In the add mdm users function

Code: Select all

function mdm_add_user(username, gecos, status) {
											
			var link1 = document.createElement('a');	
				link1.setAttribute('href', "javascript:alert('USER###"+username+"')");
				link1.setAttribute('class', "highlight-border tilt user-info");

			var link2 = document.createElement('a');	
				link2.setAttribute('href', "javascript:alert('USER###"+username+"')");
				
			var picture = document.createElement('img');
				picture.setAttribute('class', "user-picture");
				picture.setAttribute('src', "file:///home/"+username+"/.face");
				picture.setAttribute('onerror', "this.src='file:///usr/share/pixmaps/nobody.png';");
				
			var realname_div = document.createElement('div');
				realname_div.setAttribute('class', "usergecos");
				realname_div.innerHTML = gecos;
				
			var username_div = document.createElement('div');
				username_div.setAttribute('class', "username");
				username_div.innerHTML = username;

			if (status != "") {
				var userstatus_div = document.createElement('div');
				userstatus_div.setAttribute('class', "userstatus");
				userstatus_div.innerHTML = status;
			}
																																	
			link1.appendChild(picture);														
			
			if (gecos != "") {
				link2.appendChild(realname_div);	
			}
			else {
				link2.appendChild(username_div);	
			}
						
			if (status != "") {
				link2.appendChild(userstatus_div);	
			}
						
			var table = document.getElementById("users");
 
            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
          	row.username = username;          	
 
            var cell1 = row.insertCell(0);           
            cell1.width = "64px";
            cell1.appendChild(link1);                   			

            var cell2 = row.insertCell(1);           
            cell2.appendChild(link2);                   
		}	
works great but puts a new cell into a separate row, this is where I get the issue, it needs to have all cells go into one row instead.

and the scroll through code for the users to select them

Code: Select all

function select_user(index) {					
			var table = document.getElementById("users");
			var rowCount = table.rows.length;
			var row_to_select = index % rowCount;
			if (row_to_select < 0) {
				row_to_select = rowCount - 1;
			}

			for (var i = 0, row; row = table.rows[i]; i++) {				
				row.style.backgroundColor = 'rgba(80,80,80,0.0)';
			}

			var row = table.rows[row_to_select];
			row.style.backgroundColor = 'rgba(80,80,80,0.5)';     

			selected_row = row_to_select;   

			alert('USER###'+row.username);
		}	
it works great for vertical, as it creates a new row for every users, now I just got to find a way to create a table, put one row only in it and add cells into it for each users instead of rows so it lays out horizontal instead.

I really like this code and would like to keep it, just change it for cells .
I'm going to fool around with yours and this one and see if I can figure it out by mixing and matching things up.

Thanks for this I appreciate it a lot
Sam
hb1547

Re: MDM HTML5 Themes

Post by hb1547 »

samriggs wrote:it works great for vertical, as it creates a new row for every users, now I just got to find a way to create a table, put one row only in it and add cells into it for each users instead of rows so it lays out horizontal instead.
Yeah that's what I was outlining. In your code for adding a user, you can more or less drop these lines:

Code: Select all

            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
If you're not inserting new rows each time, you'll just be adding cells to the row you have, which is what you want.

In your select user code, the lines might change to something like this:

Code: Select all

function select_user(index) {               
         var table_row = document.getElementById("users_row");
         var cellCount = table_row.cells.length;
         var cell_to_select = index % cellCount;
         if (cell_to_select < 0) {
            cell_to_select = cellCount - 1;
         }

         for (var i = 0, cell; cell = table_row.cells[i]; i++) {            
            cell.style.backgroundColor = 'rgba(80,80,80,0.0)';
         }

         var cell = table_row.cells[cell_to_select];
I'm making a guess at what might work but this is the idea. You're just replacing rows with cells. Feel free to PM me with any questions
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

hb1547 wrote: Yeah that's what I was outlining. In your code for adding a user, you can more or less drop these lines:

Code: Select all

            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
If you're not inserting new rows each time, you'll just be adding cells to the row you have, which is what you want.

In your select user code, the lines might change to something like this:

Code: Select all

function select_user(index) {               
         var table_row = document.getElementById("users_row");
         var cellCount = table_row.cells.length;
         var cell_to_select = index % cellCount;
         if (cell_to_select < 0) {
            cell_to_select = cellCount - 1;
         }

         for (var i = 0, cell; cell = table_row.cells[i]; i++) {            
            cell.style.backgroundColor = 'rgba(80,80,80,0.0)';
         }

         var cell = table_row.cells[cell_to_select];
Nope ain't gona work dang nab it. This should be so simple but it just don't wanna work for some reason, must be missing something so obvious it's blinding me.
If I get rid of this part

Code: Select all

            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
then there is still this part

Code: Select all

row.username = username;          	
            var cell1 = row.insertCell(0);  
which calls row again but now there is no variable row to refer to anymore. It throws an error.
If I knock out all rows it throws cannot find var insertCell variable, if I add table instead of row another error, if I add cell and cellCount it also throws errors, I tried about ten different methods in this one little area and so far no go on everything.
Seems so simple in theory, make a table, add one row, make the user array go into cells only, done. But nope not yet.
I knock out the select part for now until I get this one little area working first, if I can this working the selection part should be easier.
jfuk86

Re: MDM HTML5 Themes

Post by jfuk86 »

found a website you guys might like

thecodeplayer.com
Brahim Salem

Re: MDM HTML5 Themes

Post by Brahim Salem »

Any new themes :roll:
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

jfuk86 wrote:found a website you guys might like

thecodeplayer.com
Thanks, I added it to my ever growing list.
anandrkris

Re: MDM HTML5 Themes

Post by anandrkris »

hb1547 wrote:I made another login theme today -- this one's a Matrix-style login one:
Wanted to share something funny that happened on applying Matrix theme. I set it as the login theme in my laptop and left for work. My dad uses same laptop (dual-boot wit Win 7, he is comfortable with Windows but does not mind using Linux sometimes and am slowly acquainting him). So he selects Mint in GRUB and then pops the matrix login, seeing that he was scared that something went wrong with system since it was displaying all black and green screen with gibberish text. He packed the laptop and was about to take it to service centre to get it rectified but thankfully Mom prompted him to check with me before doing that. Then over phone I asked him to look for blinking username and password in middle to enter credentials. He did login but was puzzled why I would want a theme like that! He is old school and dont think he ever saw the Matrix movie. :)
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

lol that's hilarious, maybe I should sneak it in on my moms once I get her out of xfce and back over to mint as a joke. shes in her seventies.
sgtconker1r

Re: MDM HTML5 Themes

Post by sgtconker1r »

Simple html5 theme.
simple mod of the included mdm html theme.

[url=http://img801.imageshack.us/img801/3914/txk.png][img]http://imageshack.us/scaled/thumb/801/txk.png[/img][/url]


i just can't seem how to remove the 'username' text beside the login box.
Any ideas
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

sgtconker1r wrote: i just can't seem how to remove the 'username' text beside the login box.
Any ideas
Nice theme :D
to answer your question it's called label
in the body of the html get rid of or comment out this part

Code: Select all

<label id="label"></label>
in the javascript for the mdm stuff above all this comment out or get rid of two lines that have label in it in these two sections

Code: Select all

// Called by MDM to allow the user to input a username		
		function mdm_prompt(message) {	
			mdm_enable();		
			//this one       document.getElementById("label").innerHTML = message;
			document.getElementById("entry").value = "";
			document.getElementById("entry").type = "text";
			document.getElementById("entry").focus();
		}
		
		// Called by MDM to allow the user to input a password
		function mdm_noecho(message) {	
			mdm_enable();		
			//this one        document.getElementById("label").innerHTML = message;
			document.getElementById("entry").value = "";
			document.getElementById("entry").type = "password";
			document.getElementById("entry").focus();
		}
That will get rid of it. Keep up the good work.
Sam
Last edited by samriggs on Thu Jun 20, 2013 3:35 pm, edited 1 time in total.
sgtconker1r

Re: MDM HTML5 Themes

Post by sgtconker1r »

Thanks! I appreciate the help.
samriggs

Re: MDM HTML5 Themes

Post by samriggs »

no problem, if you want to use mousetrap for keyboard stuff you can snag my blacknblue one it should work with yours for the keyboard stuff including users.
Check the theme.css (changes for the table and user stuff), in the html part and in the js folder there a mousetrap and bootbox file to make it all work.
Sam
sgtconker1r

Re: MDM HTML5 Themes

Post by sgtconker1r »

If I remove the <label> from the fieldset box the password would appear as plain text. So it stays
However, when I remove the JS lines with 'label'. The text would go away and the password would appear normal.
Great.
Now, since it works well on my machine.
Maybe someone else would like to test this on theirs

It can be found here. https://dl.dropboxusercontent.com/u/856 ... EME.tar.gz
Locked

Return to “Your Artwork”