Hello, again. I do believe in the last video I promised I would show you the video player of the, well, there's not massive amounts to show you, but I figure I would show you anyway, because it's a little bit different, I suppose. If you look on screen, I've got the video player, or I have a video player, and it's going to play. Oh, good. We can't hear me, thankfully. And when you go to a different section, it squishes down like that.  When you start that, it replaces the one you were on, and that behaves in the same kind of way. You can do that, you can go back, whatever. OK, so I shall show you the code for that, which is, as I say, it's not a massive amount of code. In cds.js, when I go to a new section, the unchanged, if you remember the unchanged, I basically call this toggle small player if needed in the video handler, which is a static function on the class. Toggle small player if needed, there we are. And I'm basically looking for an iframe, because if I see an iframe, then I know that you've started the YouTube video, or at least you've gone past the picture with the button to press. We've embedded the iframe. So I treat that as a fairly strong signal. On mobile, it's a bit different, because even if you, I can embed with autoplay, and that will work on desktop, but on phone, it just puts the video player there again. It's not great, but at the same time, it's not a disaster either. I don't know at this point how many people are going to be watching the live stream on a phone versus on desktop. And if they're on a phone, it's an extra tap, which is not great. It's also not a disaster. Anyway, if you have an iframe, this is where we got to. If you have an iframe, then it's playing. And it's basically if the current window location matches the href on the playing video container. So when I embed the video, and you kind of press play, I stamp into the data attribute on the video container. Let me show you. Let's do inspect, and over here in the video player. There we are. You see there's data YouTube ID, which is the YouTube ID, and data href, which is the location, the href of the page where that player was started. So if the two match, the current windows href and the href that I set, then we disable the small video player. And if not, then we enable the small video player. And if there's no playing video, then this will just do an early exit. So I think the interesting thing, though, is the technique of the animation. I have mentioned on many occasions before, and I probably will continue to mention it while it's still relevant, that animating transforms and opacity is typically the way to get decent performance out of your animations. If that's news to you, then you should have a read of the Google Web Fundamentals Rendering Performance section, or take the Udacity course that is also linked on there. And I'm sure we can pop it in the notes as well. But what we don't know, because it's a dynamic animation, it's a responsive site. So we don't know what the transform needs to be, because it could be, you're going from wherever the thing is on screen down to the bottom corner, but we don't know specifically what that transform would need to be if we were going to use a transform. So I use a technique called flip, and we have a supercharged TLDW on flip. The idea is that you can calculate the transform dynamically by saying, well, where is this thing now? And probably in that kind of big, masked head area. Oh, that's where it is. And where do I want it to be? Well, I know that, because I want it to be like 24 pixels from the bottom right-hand corner of the screen, or 32 pixels, whatever, and 32 pixels, yeah. And I want it to be 40% of its actual size. So you see what I do is I call here getBoundingClientRect, which is the get me the current position of this thing. And getBoundingClientRect has been around for ages, like, i.e. 5, 4, 5, 6, it's been around forever. It's been ages. And you get back this object with width, height, left, right, bottom, all that kind of stuff. And then we basically make all the mutations that we'd need to put it into the bottom corner. And then we ask the question a second time, where are you now? What size and everything have you got? And so we know where we were, and we know where we are. We can now figure out what transform we actually need to apply, which is like the right position from the first to the right position to the last. And so what we actually do is we've left it in that smaller bottom corner position, but we transform it back and up and out again so that it looks like it's still back in its first position. And we do all that really quickly. This all happens synchronously. So you won't actually see a frame being shipped in between these steps. And the danger point is actually this. The second time we call getBoundingClientRect, there's a moment where the browser goes, well, you've just changed a bunch of styles here. I don't know where it is. So I have to go off and apply all those styles, which we call a forced synchronous styles. Forced, I think that's a forced, yeah, forced synchronous styles, yeah. And then a forced synchronous layout pass, which is like, OK, I've applied all those styles synchronously. I couldn't do that when I suited me out to do it right now. And I have to do layout, figure out where everything is and what size it is. So if it's a big DOM, that's this point here, the second time you call getBoundingClientRect, could be very expensive. In my case, it's a small DOM, and it's a calculated risk on my part. Anyway, so we've transformed it now back up, right? So it looks like it's in the start. And then this is the bit I actually really, really dislike about the platform at the moment. You have to wait frames. So you make all those changes. And you apply that transform that brings it back up to look like it's at the start position. And then you think, OK, I could switch on animations and tell it to go down to the bottom. But that doesn't work because browsers defer all these calculations until the end, unless you ask for something up front. So the polite version, which is what I'm doing here, polite, is to call a request animation frame and be like, OK, I'm just going to wait one frame while you apply all those changes that I just made. In this case, it's just that transform. I'm going to wait one frame for that. And then I'm going to, because this could have happened part way through a frame, I wait one frame for that to take hold. And then I'm going to wait another frame. And I'm going to switch on animations. And then I'm going to wait another frame. And I'm actually now going to transform the, like, basically get rid of that translation and the scale to put it down back into the corner where I want it. And that kind of wait a frame, do a thing, wait a frame, do a thing, wait a frame, do a thing, it's an artifact of the web, which I find a bit bleh. And I think web animations would probably help here. Because the other thing I have to do, well, the other way to do this, rather than just kind of waiting a frame, is to force it by asking for offset width or offset height. Because that will force the browser to kind of apply the change. And then I can make another mutation after that. And then I can ask for offset width again. And it would force it to make the change. It would force it into the kind of reflow sort of that read write, mutation, read a thing, cycle. I'm not doing a particularly good job of explaining that. But the idea is that I can force its hand. If I do, if I wait a frame with request animation frame, I know those tasks will happen anyway, because they'll happen at the end of the previous frame. So I can sort of, I can wait a frame, a frame, and then a frame to do it. Or I could have interspersed kind of faux read calls in the middle. And because of the fact that you could save it after this first frame, this first request animation frame, you could actually go back. And that could then restore, we could switch across to setting the player back to large again, rather than small. So I actually have to manage state a little bit here and kind of go, if for some reason they've gone back to the big player during waiting for these few frames, every time I have to wait a frame, I basically go, if things have changed in the interim, it just canceled. Don't worry about setting these next things. And that's, I mean, this is not code that I like writing. And I might, I might go to the less polite version where I don't use request animation frames, and I just interspers read calls to kind of force the browser's hand. I don't like this very much. So yeah, I'm obviously probably being quite clear that I don't particularly. This is probably the bit of code in this whole thing that I'm like, oh, oh, really? No. Also at the same time, it's not the worst code I've ever written. I have written some awful code. Oh, well, we're all going to move on, haven't we? Right. So that's taking the video down to the small player. You probably won't be surprised that you pretty much are going to see the same thing in reverse when we disable the small player and go back to the big, which is, again, you sort of take a reading of where this thing is, remove everything that made it go down to the small player in the corner, ask the question again, where are you now? And then there's a little bit of a dance asking for existing transforms because of that. And then it's frame, frame, frame, the frame dance. And then we are done. So there you have it. That's basically it in a nutshell. Then there's a lot of boilerplatey stuff about making sure that we can embed a link and that when we begin playback, we do an iFrame and we embed the YouTube video and stuff like that. So most of that is boilerplate. I think it's just the technique of creating the transform on the fly that's quite interesting. So there you go. I think probably in the next video, I might talk a little bit about the side now, maybe, because I've done a little bit more work on that. You might be noticing that I do a little bit. I bounce around when I'm working on these things, like sort of what takes my fancy today, because that's one of the freedoms I have in this particular project. The deadlines are there, but within that, I can still decide which direction I go and at what point. And I'm feeling pretty OK about it. I'm feeling actually very OK about it. I'm actually really enjoying this build. It's been a good build so far. Oh, I want to let me show you this little thing here. If I just enable this scroll to, when you go from section to section to section, let's say you go back to that. I pop the screen to the top, because that's kind of more what you'd expect from the behavior of it from a site. But on the body, on the body here, I have scroll behavior smooth, which you'll notice is currently an unknown property name. In Canary, if you switch on the flag, it switches on the smooth scroll, which is already enabled in Firefox. They've already got it. Oh, oh, do you need any dance? I don't think I am going to set it as my main browser. Thank you. Tempting. OK, let's see if that works. They've removed clutter, so I can focus on what I want That's kind. Right, when we go to a section, oh, it's not working. Do I need a new version of Firefox? Let me see. Firefox is up to date. Interesting. I'm wondering why I'm not seeing the smooth scroll. Maybe I did something different than. In which case, I'll save that for another time. Just goes to show, don't do a demo on the fly when you're thinking, hey, that all went well. Why don't I just show them a little bit of extra stuff? Don't forget that you can subscribe. Don't forget that you can check out the codes on GitHub. As always, comments and all the usual stuff below. And I will see you next time.


A lot has been done over the past 30 years to improve roof and rib control technology. And there's been a reduction in roof and rib fatalities. Even so, we need always to pay attention to roof and rib control. For as long as coal has been mined underground, roof and rib falls have accounted for more fatalities than any other source. Here's why. Coal comes from plant matter covered by layers of sediment. Over millions of years, the sediment turned to rock, compressed the plant matter and transformed it into coal. The composition of the sedimentary rock that covers the coal determines the strength of the roof at your mine. This is why roof and rib conditions vary from mine to mine and sometimes from section to section within a mine. Combine this with other geologic occurrences like faults, slips, joints, cattle bottoms, thinly laminated rock, and weak or brittle rock. Humidity also plays a role in further deteriorating the immediate roof. Now what does this mean to you? Well, every day you have to deal with changing geological conditions. Every cut of coal opens up unknown territory and reveals new potential hazards. Many mines are in coal reserves that in the past were avoided because of poor roof conditions. Mines are often deeper than they used to be and they may have old works over or under them which can place additional stress on the roof and ribs. Miners often move from mine to mine. Every time they do, even if they are experienced, they have to learn about the conditions, work practices, and other hazards at their new mine. It's even more dangerous for inexperienced miners. Studies tell us that many fatalities involve minors who are new to an operation or who have little mining experience. By recognizing and understanding what makes roof and rib hazards so dangerous, we can work together to prevent injuries due to roof falls and rib rolls. Although the mine operator is responsible for providing you with the tools and training to do your job, it's your responsibility to use these resources to make conditions safe for you and your fellow miners. Your first line of defense is to pay attention to changing roof and rib conditions and to make frequent and thorough roof and rib evaluations. Conditions change constantly and your supervisor may not be aware of a change, so don't take it for granted that they know. Discuss any roof control concerns you have with your supervisor. You can do a lot to protect yourself. You have heard over and over that you need to know your mine's roof control plan Do you? Why is knowledge of the plan important to you? Let's find out. A roof control plan is not merely the brand or type of bolts that you put in a roof. To design a good roof control plan you have to get involved early on and consider the coal bed that you'll be mining. You have to consider the depth of the coal bed into the ground. You have to, through core drilling, you have to analyze the strata that lies above the coal bed and the surface. And all this figures into designing your roof control plan. Your mine's roof control plan tells the minimum that has to be done under normal conditions to support the roof. You've got to know and follow your plan's requirements. If you fail to install the proper supports required by your plan, then the roof is inadequately supported and you have jeopardized the safety of yourself and your fellow miners. The torque range is 175. A study of fatal roof fall accidents found that almost one-third of the victims were in by roof support when they were killed. Why did these miners go in by? Sometimes it's a worker that's wanting to do good and wants to hurry and hustle because a lot of times people are pressed and pushed to do a good job to maintain a job. But ultimately I think it's just a it's just a pause in a person's mind that they don't think of the ramifications that are involved when they go out beyond roof support. I don't think they've been taught or showed or trained to the extent that they need that they understand all the things that are involved and that they are actually taking their life in their own hands. And not only their life but they're endangering the livelihood of their entire crew. It is extremely important to mark the last row of bolts with highly visible markers to prevent accidental travel in by roof support. And remember, when working in low coal it may be difficult to look at the roof all the time. You're on the front line of danger if you are a continuous miner operator or helper since you're generally the miner who works closest to the pillar line in an area that's most susceptible to roof rib falls. If you're a miner operator you must make sure that you are positioned under safe roof and ribs before mining coal. Other miners and supervisors who work on retreat sections are not exempt from the hazards of roof and rib falls. The use of mobile roof support units in pillaring operations has increased over the past 10 years. An MRS unit helps to limit your exposure on the pillar line by reducing or eliminating the need for roadway timbers and radius turn posts. Don't, however, develop an attitude of complacency or a false sense of security. To realize the safety advantages afforded by MRS units you must follow proper operating procedures and safety precautions. The maximum entry and cross-cut widths specified in your roof control plan are based on the conditions at your mine. It is vital for continuous miner operators to stay within these maximum widths. And supplemental support must be installed if these maximum widths are exceeded. There are many programs available that can be used to design properly sized pillars. The software accounts for factors such as entry and cross-cut width and height, overburden, coal strength, cross-cut angles and pillar dimensions. Follow the roof-rib control plan at all times. Pay attention to the safety provisions in the plan that cover breaker and radius turn post locations, mining sequences, depth of cut, and operator location. It's especially important to do so when mining the last lift or final push. Intersections are dangerous. Although intersections account for only 10 to 20% of the developed area in a coal mine, 50% of the roof fall fatalities reviewed in recent years occurred at intersections. Some mines see much poorer roof-rib conditions in four-way intersections than in three-way intersections. Many cause four-way intersections create larger roof spans. Staggering cross-cuts to eliminate four-way intersections can help reduce the potential for a roof fall. Mines with abnormal roof and rib conditions in intersections need additional roof support in these areas. This supplemental support at intersections should be incorporated into the roof control plan. Longwall mining generally appears to be the safest underground mining method because of the protection from roof falls provided by longwall shield canopies during normal mining operations. Even so, there are times when miners have to work near the shield canopy tips or between the tips and the longwall face. This generally occurs when miners perform maintenance on the shearer or face conveyor and during longwall recovery operations. Five accidents testified to the potential roof and rib hazards on a longwall section. Three fatalities occurred during maintenance and recovery operations. A fourth happened because of a rib roll near the stage loader, and a fifth miner died from a coal outburst on the face. Roof bolter operators today often install many kinds of high-quality roof support systems. The bolts we have here are some of the supplemental roof supports we use. This is a 7-foot cable truss. They're installed on a 45-degree angle to divert the weight of an entry back over the pillars. This is an 8-foot combination bolt. We use those in our intersections in a star pattern for added support on advancement, but it really helps out when we're building. These are the 14-foot cable bolt that we use. They help when the different stratas of rock separate above the 8-footers, and this is our 4-foot conventional bolts. We use those for a rib bolting. The obvious advantage of this variety is that a mine can customize its roof support system to specific roof conditions. Follow the manufacturer's recommendations as proper installation procedure is essential to good roof bolt performance. Immediately contact your supervisor if you have any questions or concerns regarding the roof bolts that you are installing. ATRS is a great help. Do you know how to maximize the protection that an ATRS system can provide? Here's what you can do if you are a roof bolter. Report all mechanical or hydraulic problems with the ATRS system to your supervisor. Always make a thorough examination of roof and ribs before doing any work. Perform sound and vibration checks. Follow the bolt installation sequence in your mine's roof control plan. Following the approved bolting sequence is extremely critical when operating a single-boom roof bolting machine. Observe the maximum distance that an ATRS system can be set beyond the last row of bolts as listed in the roof control plan. MSHA provides technical assistance to the mining industry on roof control issues including specialized laboratory and field services. Geologists perform remote sensing linear analysis to help mine operators identify areas of potentially poor roof conditions. Technical support engineers evaluate roof support systems by conducting both laboratory and in-mine testing. They also conduct in-mine evaluations of ATRS systems and canopies on mining equipment. If you're an operator, you must provide a safe workplace by supporting or controlling the roof, face and ribs in areas where persons work or travel. Develop and follow an MSHA-approved roof control plan for your mind. Propose revisions to the roof control plan when prevailing conditions indicate that the current plan is not suitable or when accidents or injuries experienced at the mine indicate the plan is not adequate. Provide adequate training to miners about your mind's roof control plan and make sure any changes made in the plan are fully discussed and thoroughly understood before they are implemented. Provide miners with adequate machines, tools and materials to safely install roof support. Report to MSHA, unplanned roof falls, at or above the anchorage zone in active workings where roof bolts are in use. A roof and rib fall on active workings that impairs ventilation or impedes passage. A coal outburst that causes withdrawal of miners or which disrupts regular mining activities for more than one hour. And to conduct frequent and thorough examinations of roof, face and ribs. The losses that you have the right to tell MSHA at any time about a violation of the act, a violation of health and safety standards or the existence of an imminent danger. Expect that all necessary roof control related equipment are in place, used and properly maintained to inspect a copy of the approved roof control plan of the underground coal mine where you work. Receive training on roof and ground control and ventilation plans in effect at your mine. To be instructed in approved revisions to your mine's roof control plan before the approved revision is implemented. Remember, take five and stay alive. Know and follow your mine's roof control plan. Check the roof and ribs often. Be aware of your surroundings. Watch for changing conditions. Discuss all roof control concerns with your supervisor and never go under unsupported roof. For additional information, visit our website at www.mshg.gov.