Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <!-- Mirrored from demos.jquerymobile.com/1.4.5/toolbar-fixed-persistent/page-d.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 03 Jun 2017 01:40:53 GMT -->
- <!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Persistent toolbars - jQuery Mobile Demos</title>
- <link rel="shortcut icon" href="http://demos.jquerymobile.com/1.4.5/favicon.ico">
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,700">
- <link rel="stylesheet" href="http://demos.jquerymobile.com/1.4.5/css/themes/default/jquery.mobile-1.4.5.min.css">
- <link rel="stylesheet" href="http://demos.jquerymobile.com/1.4.5/_assets/css/jqm-demos.css">
- <script src="http://demos.jquerymobile.com/1.4.5/js/jquery.js"></script>
- <script src="http://demos.jquerymobile.com/1.4.5/_assets/js/index.js"></script>
- <script src="http://demos.jquerymobile.com/1.4.5/js/jquery.mobile-1.4.5.min.js"></script>
- <script>
- function generateIngredients(ingredient){
- var str = " <li class=\"dish ui-li-has-alt ui-li-has-thumb ui-last-child\"><a href=\"#\" class=\"ui-btn ui-btn-icon-right ui-icon-carat-r \"style=\"margin-right:10px; margin-left:10px;\"><img style=\"height:80px; margin-top: 20px;margin-left: 5px;\" src=";
- str += "https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/Phat_Thai_kung_Chang_Khien_street_stall.jpg/1200px-Phat_Thai_kung_Chang_Khien_street_stall.jpg";
- str += ">";
- str += "<h2>";
- str += ingredient;
- str += "</h2>";
- str += "</a></li>"
- return str;
- }
- var mydata = localStorage.getItem("data");
- $("#info").html(mydata.name);
- $(function() {
- $( "[data-role='navbar']" ).navbar();
- $( "[data-role='header'], [data-role='footer']" ).toolbar();
- // food page
- var food = {
- "name": "Green Curry",
- "host": "Matteo",
- "price": 10000,
- "img": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/Phat_Thai_kung_Chang_Khien_street_stall.jpg/1200px-Phat_Thai_kung_Chang_Khien_street_stall.jpg",
- "date": "12/20",
- "time": "11.20pm",
- "ingredient": [
- "chicken"
- ],
- "location": "Kimmel",
- "currentNum": 3,
- "maxNum": 10,
- "id": "d479cb856b934c055c8197db166566fd" // TO BE REPLACED
- };
- var name = food.name;
- var host = food.host;
- var price = food.price;
- var img = food.img;
- var date = food.date;
- var time = food.time;
- var ingredient = food.ingredient;
- var location = food.location;
- var currentNum = food.currentNum;
- var maxNum = food.maxNum;
- $("#img").attr("src", img)
- $("#name").html(name)
- $("#host").html(host)
- $("#price").html(price)
- $("#date").html(date)
- $("#time").html(time)
- myIngredients = generateIngredients(ingredient[0]);
- console.log(myIngredients);
- $("#ingredients").append(myIngredients);
- $("#addImage").click(function(){
- console.log("clicked");
- })
- // $.get('https://gateway.watsonplatform.net/discovery/api/v1/environments/cbd7065e-8e38-4ea6-9bc5-0f71bdd5a3bc/collections/1bce84dc-a68a-44dc-8799-7f2f85f82b9b/query?version=2016-11-07&query=&count=&offset=&aggregation=&filter=&passages=false&highlight=true&return=',function(data){
- // console.log(data);
- // });
- var username = "1a6b81a5-6f50-4b65-8428-789819ea70d3";
- var password = "t1WDv4Uuvrvh";
- var queryString = "\"" + name + "\"";
- var foodName = encodeURIComponent(queryString);
- $.ajax
- ({
- type: "GET",
- url: "https://gateway.watsonplatform.net/discovery/api/v1/environments/cbd7065e-8e38-4ea6-9bc5-0f71bdd5a3bc/collections/1bce84dc-a68a-44dc-8799-7f2f85f82b9b/query?version=2016-11-07&query="+foodName+ "&count=5&offset=&aggregation=term%28docSentiment.type%2Ccount%3A3%29&filter=blekko.hostrank%3E20%2Cblekko.chrondate%3E1493870400%2Cblekko.chrondate%3C1496462400&passages=false&highlight=true&return=",
- dataType: 'json',
- beforeSend: function (xhr) {
- xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
- },
- success: function (data){
- var results = data.aggregations[0].results;
- console.log(results);
- var positive;
- var negative;
- var neutral;
- for (var i=0;i<results.length;i++){
- if (results[i].key === "positive"){
- positive = results[i].matching_results;
- }
- }
- for (var i=0;i<results.length;i++){
- if (results[i].key === "negative"){
- negative = results[i].matching_results;
- }
- }
- for (var i=0;i<results.length;i++){
- if (results[i].key === "neutral"){
- neutral = results[i].matching_results;
- }
- }
- // var negative = results[0].matching_results;
- // var positive = results[1].matching_results;
- // var neutral = results[2].matching_results;
- var sum = positive+negative+neutral;
- var percPos = positive/sum * 100;
- var percNeg = negative/sum * 100;
- $("#percPos").html((percPos).toFixed(2)+"%");
- $("#percNeg").html((percNeg).toFixed(2)+"%");
- // console.log(neutral/sum);
- }
- });
- // $("#supportDish").click(function(){
- // var myObj = { "currentNum": currentNum +1 };
- // var id = food.id;
- // console.log(myObj)
- // console.log(id)
- // $.post("https://homemade.mybluemix.net/api/Dishes/update?where=%7B%22id%22%3A%20%22"+id+"%22%7D", myObj).done(function(data){
- // console.log("posted");
- // });
- // })
- $("#img1").click(function(){
- $.get("http://localhost:5000/peas",function(data){
- console.log(data);
- });
- });
- $("#img2").click(function(){
- $.get("http://localhost:5000/bread",function(data){
- console.log(data);
- });
- });
- $("#img3").click(function(){
- $.get("http://localhost:5000/apple",function(data){
- console.log(data);
- });
- });
- });
- // Update the contents of the toolbars
- $( document ).on( "pagecontainerchange", function() {
- // Each of the four pages in this demo has a data-title attribute
- // which value is equal to the text of the nav button
- // For example, on first page: <div data-role="page" data-title="Info">
- var current = $( ".ui-page-active" ).jqmData( "title" );
- // Change the heading
- $( "[data-role='header'] h1" ).text( current );
- // Remove active class from nav buttons
- $( "[data-role='navbar'] a.ui-btn-active" ).removeClass( "ui-btn-active" );
- // Add active class to current nav button
- $( "[data-role='navbar'] a" ).each(function() {
- if ( $( this ).text() === current ) {
- $( this ).addClass( "ui-btn-active" );
- }
- });
- });
- </script>
- </head>
- <body>
- <div data-role="header" data-position="fixed" data-theme="a">
- <a href="http://demos.jquerymobile.com/1.4.5/toolbar/" data-rel="back" class="ui-btn ui-btn-left ui-alt-icon ui-nodisc-icon ui-corner-all ui-btn-icon-notext ui-icon-carat-l">Back</a>
- <h1>Emails</h1>
- </div><!-- /header -->
- <div data-role="page" data-title="Emails">
- <div style="display:flex; flex-direction:row;">
- <div style="flex:0.7">
- <img src="" id="img" style="width: 170px; margin: 20px;"/>
- </div>
- <div style="flex:0.5; ">
- <h1 id="name" style="margin:0px; margin-top:30px;"></h1>
- <p id="host" style="margin:0px; margin-top: 10px;"></p>
- <p id="price" style="margin:0px;"></p>
- <p id="date" style="margin:0px;"></p>
- <p id="time" style="margin:0px;"></p>
- </div>
- </div>
- <div>
- <h3 style="margin-left:10px;">Ingredients</h3>
- <ul data-role="listview" data-filter-theme="a" id="ingredients">
- </ul>
- </div>
- <div>
- <h3 style="margin-left:10px;">Location</h3>
- <center>
- <img src="http://i.imgur.com/YUYky2d.png" style="width: 250px;"/>
- </center>
- </div>
- <div>
- <h3 style="margin-left:10px;">Sentiments powered by IBM</h3>
- <center>
- <div style="display:flex; flex-direction:row; width: 200px;">
- <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Gold_Star.svg/2000px-Gold_Star.svg.png" style="width: 60px; height: 60px; flex:1"/>
- <div style="flex:1; margin-left: 15px;">
- <p style="flex:0.5; color:green;" id="percPos"></p>
- <p style="flex:0.5; color:red;" id="percNeg"></p>
- </div>
- </div>
- </center>
- <center>
- <a style="color:green;" id="supportDish" href="#backDishPopup" data-rel="popup" data-position-to="window">Back this Dish!
- </a>
- </center>
- </div>
- <div data-role="popup" id="backDishPopup" class="ui-content" style="height: 400px; width: 300px;">
- <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
- <h3>Contribute Ingredients</h3>
- <center>
- <div data-role="collapsible" data-theme="b" data-content-theme="b">
- <h3>Select an Image</h3>
- <div id="row1" style="display:flex; flex-direction:row;">
- <img style="flex:0.3; height:90px;" src="../../../img/peas.jpg" id="img1"/>
- <img style="flex:0.3; height:90px;" src="../../../img/bread.jpg" id="img2"/>
- <img style="flex:0.3; height:90px;" src="../../../img/apple.jpeg" id="img3"/>
- </div>
- </div>
- </center>
- <div id="foodImages">
- <div id="row2" style="display:flex; flex-direction:row;">
- </div>
- </div>
- </div>
- <div data-role="popup" id="ingredients" class="ui-content" style="height: 400px; width: 300px;">
- </div>
- <div data-role="popup" id="chatbot" class="ui-content" style="height: 400px; width: 300px;">
- <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
- <div id="chat-box-div" style=" position: relative; clear: both;border: 1px black solid;">
- </div>
- </div>
- <h1 id="info"></h1>
- </div><!-- /page -->
- <div data-role="footer" data-position="fixed" data-theme="a">
- <div data-role="navbar">
- <ul>
- <li><a href="index-2.html" data-prefetch="true" data-transition="fade">Info</a></li>
- <li><a href="page-b.html" data-prefetch="true" data-transition="flip">Friends</a></li>
- <li><a href="page-c.html" data-prefetch="true" data-transition="turn">Albums</a></li>
- <li><a href="page-d.html" data-prefetch="true" data-transition="slide">Emails</a></li>
- </ul>
- </div><!-- /navbar -->
- </div><!-- /footer -->
- </body>
- <script src="/node_modules/card/dist/jquery.card.js"></script>
- <!-- Mirrored from demos.jquerymobile.com/1.4.5/toolbar-fixed-persistent/page-d.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 03 Jun 2017 01:40:53 GMT -->
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement