如何创建类别,例如如何?什么时候?为什么?在某些视频中会显示很多文字? [英] How can i create categories e.g. How? When? Why? for a lot of text that will show for certain videos?

查看:78
本文介绍了如何创建类别,例如如何?什么时候?为什么?在某些视频中会显示很多文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我拥有的文本创建类别,因此我希望它能使例如随机视频播放并着陆在红色上时,我希望该类别中的任何文本(何时?)出现,如果它降落在蓝色上,然后我希望类别中的任何文本(如何显示)等...

I am trying to create categories for the text I have and I want it so that when a random video plays and lands on the color red for example then I want any text from the category (when?) to show up and if it lands on the color blue then I want any text from the category (how?) to show up etc...

这是代码:

<html>

<head>
  <link rel="stylesheet" type="text/css" href="style.css" title="Default Styles"/>
    <script>

var r_text = new Array();
r_text[0] = "How can we become more self-organised in the next sprint?";
r_text[1] = "How can we improve our productivity, increase our velocity?";
r_text[2] = "How can we get better in Transparency and Visibility of issues and challenges?";
r_text[3] = "How can our PO help us, to focus more on the sprint goal?";
r_text[4] = "How can our SM help us improve our delivery?";
r_text[5] = "How can we be more T-shaped in the next sprint?";
r_text[6] = "How should we celebrate our successes more?";
r_text[7] = "How can we reduce our cycle times?";
r_text[8] = "How can we make our daily scrum more effective?";
r_text[9] = "How can we improve our delivery flow by applying WIP Limit?";
r_text[10] = "How can we improve our collaboration?";
r_text[11] = "How can I help someone else in the next sprint?";
r_text[12] = "How can we improve our Sprint planning event?";
r_text[13] = "How can we demonstrate Scrum Value Courage more?";
r_text[14] = "How can we demonstrate Scrum Value Respect more?";
r_text[15] = "How can we demonstrate Scrum Value Focus more?";
r_text[16] = "How can we demonstrate Scrum Value Commitment more?";
r_text[17] = "How can we demonstrate Scrum Value Commitment more?";
r_text[18] = "How can we demonstrate Scrum Value Commitment more?";
r_text[19] = "How can we demonstrate Scrum Value Commitment more?";
r_text[20] = "How can we demonstrate Scrum Value Commitment more?";
var i = Math.floor(20*Math.random())

var videos = [{
    id: 1,
    url: "https://www.youtube.com/embed/ngUMyF9D9SQ?autoplay=1",
    text: r_text[i]
  },
  {
    id: 2,
    url: "https://www.youtube.com/embed/r-l_gVPVylM?autoplay=1",
    text: r_text[i]
  },
  {
    id: 3,
    url: "https://www.youtube.com/embed/6ukTzRjXcR0?autoplay=1",
    text: r_text[i]
  },
  {
    id: 4,
    url: "https://www.youtube.com/embed/n5BXMNCTu8I?autoplay=1",
    text: r_text[i]
  },
  {
    id: 5,
    url: "https://www.youtube.com/embed/JtwVmnMNaEY?autoplay=1",
    text: r_text[i]
  },
  {
    id: 6,
    url: "https://www.youtube.com/embed/lAMgRaHP8Q4?autoplay=1",
    text: r_text[i]
  }

];

window.onload = function() {
  function rollVideo(numberRand) {
    let playerDiv = document.getElementById("random_player");
    if (document.querySelector("iframe") !== null) {
      document.querySelector("iframe").remove();
    }
    let player = document.createElement("IFRAME");
    let randomVideoUrl = videos[numberRand].url;
    player.setAttribute("width", "640");
    player.setAttribute("height", "390");
    player.setAttribute("src", randomVideoUrl);
    playerDiv.appendChild(player);
    document.getElementById("r_text").innerHTML = "";
    document.getElementById("r_text").innerHTML = r_text[Math.floor(6*Math.random())];
  }


  document.getElementById("btn-roll").addEventListener("click", startRoll);

  function startRoll() {
    let currentNumber = Math.floor(Math.random() * videos.length);
    rollVideo(currentNumber);
  }
};





    </script>
</head>


<div id="random_player">
  <div id="r_text">
  </div>
</div>
<button id="btn-roll">Roll</button>
</html>

推荐答案

到目前为止,这是我所做的,因此我制作了3个数组,但还有很多,但我不确定如何将它们放入用作某些视频的类别,例如如果视频以红色着陆,那么我希望选择并显示var对话"中的随机文本.

This is what I have done so far so I have made 3 arrays at the moment there are more to come but im not quite sure how I can get them to work as categories for certain videos e.g. if the video lands on the color red then I want random text from the var "talk" to be chosen and displayed.

<html>

<head>
  <link rel="stylesheet" type="text/css" href="style.css" title="Default Styles"/>
    <script>

var r_text = new Array();
r_text[0] = "How can we become more self-organised in the next sprint?";
r_text[1] = "How can we improve our productivity, increase our velocity?";
r_text[2] = "How can we get better in Transparency and Visibility of issues and challenges?";
r_text[3] = "How can our PO help us, to focus more on the sprint goal?";
r_text[4] = "How can our SM help us improve our delivery?";
r_text[5] = "How can we be more T-shaped in the next sprint?";
r_text[6] = "How should we celebrate our successes more?";
r_text[7] = "How can we reduce our cycle times?";
r_text[8] = "How can we make our daily scrum more effective?";
r_text[9] = "How can we improve our delivery flow by applying WIP Limit?";
r_text[10] = "How can we improve our collaboration?";
r_text[11] = "How can I help someone else in the next sprint?";
r_text[12] = "How can we improve our Sprint planning event?";
r_text[13] = "How can we demonstrate Scrum Value Courage more?";
r_text[14] = "How can we demonstrate Scrum Value Respect more?";
r_text[15] = "How can we demonstrate Scrum Value Focus more?";
r_text[16] = "How can we demonstrate Scrum Value Commitment more?";
r_text[17] = "How can we demonstrate Scrum Value Openness more?";
r_text[18] = "How can we make Sprint Review more effective?";
r_text[19] = "How can I help PO breakdown user stories better?";
r_text[20] = "How can we improve user story refinement?";
r_text[21] = "How did you overcome a dfficult situation/chalenge?";
r_text[22] = "How can we be more confident about our delivery?";
r_text[23] = "How well do you communicate with others?";
r_text[24] = "How well the team communicates with each other?";
var i = Math.floor(20*Math.random())

var talk = new Array();
talk[0] = "Talk about issues in our Processes";
talk[1] = "Talk about issues in the Team behaviour";
talk[2] = "Talk about what you want your team to do more";
talk[3] = "Talk about what you want the team to stop doing";
talk[4] = "Talk about what you want the team to start doing";
talk[5] = "Tell us about something that helped you during the sprint to achieve work";
talk[6] = "Talk about something you learnt during the  previous sprint";
talk[7] = "Talk about your sprint experience through a sport's game?";
talk[8] = "Talk about your worst time during the sprint?";
talk[9] = "Talk about the biggest success during the sprint?";
talk[10] = "Talk about he major issue you faced during the sprint?";
talk[11] = "Talk about a most recent problem and how did you overcome it?";
talk[12] = "Talk about something that you feared during sprint planning however it was not mentioned at that time?";
talk[13] = "Talk about someone in the team you inspire from and why? Don’t mention the name";

var what = new Array();
what[0] = "What can Scrum Master to improve our Scrum Events?";
what[1] = "What made you feel happy?";
what[2] = "What made you feel unhappy?";
what[3] = "What was your key observations?";
what[4] = "What minor issues that slowed you down";
what[5] = "What can we change to make the biggest leap ahead?";
what[6] = "What did you see happening by someone you think everyone should try?";
what[7] = "What advise would you give to your team members? And why?";
what[8] = "What has been the biggest challenge so far?";
what[9] = "Which problems came up most frequently?";
what[10] = "What has been the most difficult situation in the sprint?";
what[11] = "What obstacles do you anticipate and how you think that can be addressed?";
what[12] = "What can we do to improve our Sprint planning event?";
what[13] = "What would you do differently in the next Sprint?";
what[14] = "What would you like to avoid in the next Sprint?";
what[15] = "What can we do to make our Scrum events more fun?";
what[16] = "What can we do to get full trust of our key stakeholders?";
what[17] = "What support do we need from our PO?";
what[18] = "What support do we need from our SM?";
what[19] = "What support do we need from our Stakeholders? Sponsrs/External…";
what[20] = "Describe the most difficult challenge team faced? What could have been done to avoid/fix it?";
what[21] = "What do you wish you could change in the way of working?";
what[22] = "What support do you need to achieve your sprint goal?";
what[23] = "What areas of your team WOW would you like to improve/change?";
what[24] = "What routinely gets in your way?";
what[25] = "What would you like your PO to do more and why?";
what[26] = "What would you like your SM to do less and why?";


var videos = [{
    id: 1,
    url: "https://www.youtube.com/embed/ngUMyF9D9SQ?autoplay=1",
    text: r_text[i]
  },
  {
    id: 2,
    url: "https://www.youtube.com/embed/r-l_gVPVylM?autoplay=1",
    text: r_text[i]
  },
  {
    id: 3,
    url: "https://www.youtube.com/embed/6ukTzRjXcR0?autoplay=1",
    text: r_text[i]
  },
  {
    id: 4,
    url: "https://www.youtube.com/embed/n5BXMNCTu8I?autoplay=1",
    text: r_text[i]
  },
  {
    id: 5,
    url: "https://www.youtube.com/embed/JtwVmnMNaEY?autoplay=1",
    text: r_text[i]
  },
  {
    id: 6,
    url: "https://www.youtube.com/embed/lAMgRaHP8Q4?autoplay=1",
    text: r_text[i]
  }

];

window.onload = function() {
  function rollVideo(numberRand) {
    let playerDiv = document.getElementById("random_player");
    if (document.querySelector("iframe") !== null) {
      document.querySelector("iframe").remove();
    }
    let player = document.createElement("IFRAME");
    let randomVideoUrl = videos[numberRand].url;
    player.setAttribute("width", "640");
    player.setAttribute("height", "390");
    player.setAttribute("src", randomVideoUrl);
    playerDiv.appendChild(player);
    document.getElementById("r_text").innerHTML = "";
    document.getElementById("r_text").innerHTML = r_text[Math.floor(6*Math.random())];
  }


  document.getElementById("btn-roll").addEventListener("click", startRoll);

  function startRoll() {
    let currentNumber = Math.floor(Math.random() * videos.length);
    rollVideo(currentNumber);
  }
};





    </script>
</head>


<div id="random_player">
  <div id="r_text">
  </div>
</div>
<button id="btn-roll">Roll</button>
</html>

这篇关于如何创建类别,例如如何?什么时候?为什么?在某些视频中会显示很多文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆