Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thatappleguytoday

macrumors 601
Original poster
Feb 9, 2006
4,162
9,072
Jacksonville, FL
Hi everyone

The Post Your Screenshot thread is getting way to cluttered with support HTML and CSS file questions.

I thought this might be a nice way to clean up the other thread and now we can have 2 separate threads.

I hope this gets used often, because we all can help each other with problems we might be having. :D

I am more than willing to help members with questions they might have and hope others will do the same
 
this is just the kind of help I need!!!!

here's my issue.I have a theme that is using two bits of javscript to perform tasks

task 1 rotate the wallpaper
task 2 falling snow effect

I've copied the two fields below (wallpaper.htm) and snow.js

the bit highlighted in red below is my problem..I think...

if I include this..then the wallpapers change perfectly...but the snow flakes don't work. if I remove this bit, then the snow works perfectly, but the wallpaper changes from image, to nothing, then image, then nothing (it should be image to image to image etc)

so, this is my wallpaper.htm file

<script src="Snow.js" type="text/javascript" charset="utf-8"></script>
<style>

img {
position: absolute;
width: 320px;
height: 480px;
}


img.fade-out {
-webkit-transition-property: opacity;
-webkit-transition-duration: 1s;
opacity: 0;
}

img.fade-in {
opacity: 1;
}
</style>
</head>
<body>
<img id="img1" class="fade-in">
<img id="img2" class="fade-out">
<script>


// Displays each image once in random order before
// randomizing the list again.
// Just add the image's filename to the list to add an image,
// and change interval to control the cycle speed.

var interval = 10; // Seconds between change (must be > duration)
var imageDir = ""; // The path containing the images
var duration = 1; // The transition's duration in seconds
// Must match -webkit-transition-duration above
var images = [ // List of image filenames
"xmas0.jpg",
"xmas1.jpg",
"xmas2.jpg",
"xmas3.jpg",
"xmas4.jpg",
"xmas5.jpg",
"xmas6.jpg",
"xmas7.jpg",
];

//// You shouldn't need to change anything below ////

var index = 0;
var imageCount = images.length;

var randomize = function(){
return Math.round(5 - 10 * Math.random());
};

var fade = function(){
img1.style.zIndex = 1;
img2.style.zIndex = 2;
img1.className = "fade-in";
img2.className = "fade-out";

index = (index + 1) % imageCount;
if(!index){
images.sort(randomize);
}

var tmp = img1;
img1 = img2;
img2 = tmp;

setTimeout(function(){img1.src = imageDir + images[index];}, duration * 1000);
setTimeout(fade, interval * 1000);
};

images.sort(randomize);
img1.src = imageDir + images[index];
fade();
</script>

<div id="snowContainer"></div>



and this is the snow.js file

var NUMBER_OF_SNOWFLAKES = 25;

function init()
{
/* Get a reference to the element that will contain the flakes */
var container = document.getElementById('flakeContainer');
/* Fill the empty container with new snow */
for (var i = 0; i < NUMBER_OF_SNOWFLAKES ; i++)
{
container.appendChild(createAflake());
}
}

function randomInteger(low, high)
{
return low + Math.floor(Math.random() * (high - low));
}


function randomFloat(low, high)
{
return low + Math.random() * (high - low);
}


function pixelValue(value)
{
return value + 'px';
}

function durationValue(value)
{
return value + 's';
}

function createAflake()
{
/* Start by creating a wrapper div, and an empty img element */
var flakeDiv = document.createElement('div');
var image = document.createElement('img');

/* Randomly choose a flake image and assign it to the newly created element */
image.src = 'snow.gif';

/* Position the flake at a random location within the screen */
flakeDiv.style.top = pixelValue(randomInteger(-150, -50));
flakeDiv.style.left = pixelValue(randomInteger(0, 500));

/* Randomly choose a spin animation */
var spinAnimationName = (Math.random() < 0.5) ? 'clockwiseSpin' : 'counterclockwiseSpinAndFlip';

/* Set the -webkit-animation-name property with these values */
leafDiv.style.webkitAnimationName = 'fade, drop';
image.style.webkitAnimationName = spinAnimationName;

/* Figure out a random duration for the fade and drop animations */
var fadeAndDropDuration = durationValue(randomFloat(5, 11));

/* Figure out another random duration for the spin animation */
var spinDuration = durationValue(randomFloat(4, 8));
/* Set the -webkit-animation-duration property with these values */
flakeDiv.style.webkitAnimationDuration = fadeAndDropDuration + ', ' + fadeAndDropDuration;
image.style.webkitAnimationDuration = spinDuration;

/* Add the created image to the div */
flakeDiv.appendChild(image);

/* Return this div so it can be added to the document */
return flakeDiv;
}

window.addEventListener('load', init, false);



so..it looks like something to do with img container being used in two places?? I'm not a javascript guru..or even a semi guru..and am completely stuck. it may be that this will never work, but thanks for any pointers
 
I got a question that no one can seem to answer - how do you make the calendar widget display monday as the first day of the week instead of sunday? If anyone actually wants to try and do this, I will upload the code, but I don't want to swamp the thread with it if no one cares.
 
The problem is you are applying CSS to all images. The rotating wallpaper needs that style. The snowflakes do not.

Whatever you do, remove this block:

img {
position: absolute;
width: 320px;
height: 480px;
}

Just put the style directly on the original img tags, which is honestly the best method since nothing else in the file modifies those CSS properties:

Code:
<img id="img1" class="fade-in" style="height:480px;width:320px;position:absolute;">
<img id="img2" class="fade-out" style="height:480px;width:320px;position:absolute;">

One of those two should work.


I got a question that no one can seem to answer - how do you make the calendar widget display monday as the first day of the week instead of sunday? If anyone actually wants to try and do this, I will upload the code, but I don't want to swamp the thread with it if no one cares.

I could probably help you with this if you either post the code or PM it
 
Last edited:
I got a question that no one can seem to answer - how do you make the calendar widget display monday as the first day of the week instead of sunday? If anyone actually wants to try and do this, I will upload the code, but I don't want to swamp the thread with it if no one cares.

My thoughts exactly. From what I've found out it seems to be related to the Region Format (Settings, General, International). Others have switched to UK or Ireland but it changes the phone number format too. I think finding that configuration file is the key.
Try changing the region format and then editing the array in the configME.js to have Mon first. That way Wed is #3 in the array instead of #4 and so on.
 
My thoughts exactly. From what I've found out it seems to be related to the Region Format (Settings, General, International). Others have switched to UK or Ireland but it changes the phone number format too. I think finding that configuration file is the key.
Try changing the region format and then editing the array in the configME.js to have Mon first. That way Wed is #3 in the array instead of #4 and so on.

A few quick lines changed! Just had to change around the date array and do some subtracting on the day number to get it to spit out of the proper day on the right day. It might have a problem with either Sunday or Monday... not sure which...

Here is the updated Wallpaper.html. Seems to work perfect, but as always, YMMV
 

Attachments

  • Wallpaper.html.zip
    2.1 KB · Views: 196
Last edited:
Is there a way for the calendar/weather widget to only show up on the first page (homescreen) and not all the other pages?
 
The problem is you are applying CSS to all images. The rotating wallpaper needs that style. The snowflakes do not.

Whatever you do, remove this block:



Just put the style directly on the original img tags, which is honestly the best method since nothing else in the file modifies those CSS properties:

Code:
<img id="img1" class="fade-in" style="height:480px;width:320px;position:absolute;">
<img id="img2" class="fade-out" style="height:480px;width:320px;position:absolute;">

One of those two should work.

Actually, in-line CSS is a very nasty approach to doing clean CSS.

The most elegant solution to his problem is to modify that img CSS block. I notice in his code that img1 and img2 has the class names "fade-in" and "fade-out"... Thus, all he has to do is modify his red highlighted CSS chunk to look like this:
Code:
[COLOR="Red"]img.fade-in, img.fade-out[/COLOR] {
position: absolute;
width: 320px;
height: 480px;
}

OR

Code:
[COLOR="Red"]img#img1, img#img2[/COLOR] {
position: absolute;
width: 320px;
height: 480px;
}

Pick one.
 
Last edited:
A few quick lines changed! Just had to change around the date array and do some subtracting on the day number to get it to spit out of the proper day on the right day. It might have a problem with either Sunday or Monday... not sure which...

Here is the updated Wallpaper.html. Seems to work perfect, but as always, YMMV

I will try this out, thanks very much!
 
A few quick lines changed! Just had to change around the date array and do some subtracting on the day number to get it to spit out of the proper day on the right day. It might have a problem with either Sunday or Monday... not sure which...

Here is the updated Wallpaper.html. Seems to work perfect, but as always, YMMV

I tried your Wallpaper.html but it varies too much from mine for me to try and merge the two. Here is the widget that I'm working with, so if you could take a look at this one, that would be amazing. https://forums.macrumors.com/threads/1057158/
 
Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7)

murdercitydevil said:
I got a question that no one can seem to answer - how do you make the calendar widget display monday as the first day of the week instead of sunday? If anyone actually wants to try and do this, I will upload the code, but I don't want to swamp the thread with it if no one cares.

I think I've answered this on either another thread/forum.

Go into the calendar/calendersb.js file and change SMTWTFS to MTWTFSS

save and reboot
 
Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7)



I think I've answered this on either another thread/forum.

Go into the calendar/calendersb.js file and change SMTWTFS to MTWTFSS

save and reboot

That isn't enough. You also have to modify the day number variable or else the day will be one off. JavaScript defaults to a Sunday based start date, ie Sunday == 0. You have to subtract 1 from the day number and then roll it around back to 6 if it drops below 0 to have it be a Monday based week.
 
Last edited:
Per LEXS latest lockscreen theme, I loaded it and I have a couple issues. 1.) I am seeing 24 hour clock and can't find what I need to modify to get 12 hour clock. 2.) My lock screen has the stock clock sitting on top of the theme - how do I get rid of that? Use coding or use the cydia application? If it's in coding, what do I need to change? Or modify in lockinfo?

I'm also missing the notifications bar with phone, sms, calendar, etc. Looks like the coding is present but it's not showing up.
 
Is this possible?

photo-1.png

Is there anyway, for an example, you have a new text that you can click on the text icon to reply quickly after entering the passcode? Or click mail to open mail after typing in passcode? Same with other notifications.

This way the person can't read any of your messages by the preview but a quick access to respond.
 
And this annoying ad is stuck on my home screen
 

Attachments

  • ImageUploadedByTapatalk1297913886.377946.jpg
    ImageUploadedByTapatalk1297913886.377946.jpg
    27.3 KB · Views: 215
Per LEXS latest lockscreen theme, I loaded it and I have a couple issues. 1.) I am seeing 24 hour clock and can't find what I need to modify to get 12 hour clock. 2.) My lock screen has the stock clock sitting on top of the theme - how do I get rid of that? Use coding or use the cydia application? If it's in coding, what do I need to change? Or modify in lockinfo?

I'm also missing the notifications bar with phone, sms, calendar, etc. Looks like the coding is present but it's not showing up.

Download lockscreen clock hide in cydia...this will help u out

Not on my comp, but there is code in the HTML file that can change the clock to 12 hour format

Hopefully someone can post it and help you out
 
Download lockscreen clock hide in cydia...this will help u out

Not on my comp, but there is code in the HTML file that can change the clock to 12 hour format

Hopefully someone can post it and help you out

Got most of this figured out. All i'm missing is the notification bar with phone, sms, email, etc. Then the 12 hour coding problem. I have scoured the coding and nothing seems obvious.
 
What do you guys use to hide the page dots? There are two in Cydia one is a theme and the other is a tweak.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.