Advertisement
Jelbs

Untitled

Dec 13th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2.  
  3. <head>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  6.   <meta name="apple-mobile-web-app-capable" content="yes">
  7.   <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8.   <title>My App</title>
  9.   <!-- Path to Framework7 Library CSS-->
  10.   <link rel="stylesheet" href="../../dist/css/framework7.ios.min.css">
  11.   <!-- Path to your custom app styles-->
  12.   <link rel="stylesheet" href="css/my-app.css">
  13. </head>
  14.  
  15. <body>
  16.   <!-- Status bar overlay for fullscreen mode-->
  17.   <div class="statusbar-overlay"></div>
  18.  
  19.   <!-- Views, and they are tabs-->
  20.   <!-- We need to set "toolbar-through" class on it to keep space for our tab bar-->
  21.   <div class="views tabs toolbar-through">
  22.     <!-- Your first view, it is also a .tab and should have "active" class to make it visible by default-->
  23.     <div id="view-1" class="view view-main tab active">
  24.       <!-- Pages-->
  25.       <div class="pages">
  26.         <!-- Page, data-page contains page name-->
  27.         <div data-page="index-1" class="page">
  28.           <!-- Scrollable page content-->
  29.           <div class="page-content">
  30.             <div class="content-block-title"> Welcome </div>
  31.             <div class="content-block">
  32.               <html>
  33.  
  34.               <head>
  35.  
  36.                 <div class="fb-login-button" data-max-rows="1" data-size="large" data-button-type="login_with" data-show-faces="true" data-auto-logout-link="true" data-use-continue-as="true"></div>
  37.  
  38.               </head>
  39.  
  40.               <body>
  41.  
  42.                 <!-- My old Fb login simple to work on  -->
  43.  
  44.                 <!-- <div id="fb-root"></div>
  45.                 <script>(function(d, s, id) {
  46.                 var js, fjs = d.getElementsByTagName(s)[0];
  47.                 if (d.getElementById(id)) return;
  48.                 js = d.createElement(s); js.id = id;
  49.                 js.src = 'https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.10&appId=1905510656375444';
  50.                 fjs.parentNode.insertBefore(js, fjs);
  51.               }(document, 'script', 'facebook-jssdk'));</script> -->
  52.  
  53.               <!-- This other fb login methods allows me to get user details such as their user ID to which we will need further down the code -->
  54.               <!-- facebook login starts -->
  55.               <script>
  56.              
  57.                var userId; //creating variable user ID that will be ised later
  58.              
  59.               // This is called with the results from from FB.getLoginStatus().
  60.               function statusChangeCallback(response) {
  61.                 console.log('statusChangeCallback');
  62.                 console.log(response);
  63.                 // The response object is returned with a status field that lets the
  64.                 // app know the current login status of the person.
  65.                 // Full docs on the response object can be found in the documentation
  66.                 // for FB.getLoginStatus().
  67.                 if (response.status === 'connected') {
  68.                   // Logged into your app and Facebook.
  69.                   testAPI();
  70.                   $(".loginIn").hide();
  71.                   $(".loginOut").show();
  72.                 } else {
  73.                   // The person is not logged into your app or we are unable to tell.
  74.                   document.getElementById('status').innerHTML = 'Please log ' +
  75.                   'into this app.';
  76.                   $(".loginIn").show();
  77.                   $(".loginOut").hide();
  78.                 }
  79.               }
  80.  
  81.               // This function is called when someone finishes with the Login
  82.               // Button.  See the onlogin handler attached to it in the sample
  83.               // code below.
  84.               function checkLoginState() {
  85.                 FB.getLoginStatus(function(response) {
  86.                   statusChangeCallback(response);
  87.  
  88.  
  89.                 });
  90.               }
  91.  
  92.               window.fbAsyncInit = function() {
  93.                 FB.init({
  94.                   appId      : '1079006898900009',
  95.                   cookie     : true,  // enable cookies to allow the server to access
  96.                   // the session
  97.                   xfbml      : true,  // parse social plugins on this page
  98.                   version    : 'v2.10' // use graph api version 2.8
  99.                 });
  100.  
  101.                 // Now that we've initialized the JavaScript SDK, we call
  102.                 // FB.getLoginStatus().  This function gets the state of the
  103.                 // person visiting this page and can return one of three states to
  104.                 // the callback you provide.  They can be:
  105.                 //
  106.                 // 1. Logged into your app ('connected')
  107.                 // 2. Logged into Facebook, but not your app ('not_authorized')
  108.                 // 3. Not logged into Facebook and can't tell if they are logged into
  109.                 //    your app or not.
  110.                 //
  111.                 // These three cases are handled in the callback function.
  112.  
  113.                 FB.getLoginStatus(function(response) {
  114.                   statusChangeCallback(response);
  115.  
  116.                 });
  117.  
  118.               };
  119.  
  120.               // Load the SDK asynchronously
  121.               (function(d, s, id) {
  122.                 var js, fjs = d.getElementsByTagName(s)[0];
  123.                 if (d.getElementById(id)) return;
  124.                 js = d.createElement(s); js.id = id;
  125.                 js.src = "//connect.facebook.net/en_US/sdk.js";
  126.                 fjs.parentNode.insertBefore(js, fjs);
  127.               }(document, 'script', 'facebook-jssdk'));
  128.  
  129.               // Here we run a very simple test of the Graph API after login is
  130.               // successful.  See statusChangeCallback() for when this call is made.
  131.               function testAPI() {
  132.  
  133.                 console.log('Welcome!  Fetching your information.... ');
  134.  
  135.                 FB.api('/me', function(response) {
  136.                   console.log('Successful login for: ' + response.id);
  137.  
  138.                   document.getElementById('status').innerHTML =
  139.                   response.id;
  140.  
  141.                   userId = response.id;
  142.                   // voce pode usar essa variavel fbid pra colocar dentro de uma div ou na part pra mandar pro db,
  143.                   //pois ela se torna uma variavel global na pagina inteira
  144.  
  145.  
  146.  
  147.                 });
  148.               }
  149.              
  150.               </script>
  151.  
  152.               <script>
  153.               function logoutPerson(){
  154.  
  155.                 FB.logout(function(response) {
  156.                   // Person is now logged out
  157.  
  158.                   window.location.reload();
  159.                   //and the page is refreshed
  160.                 });
  161.  
  162.  
  163.               }
  164.  
  165.  
  166.               </script>
  167.               <!-- facebook login ends -->
  168.               <div id="facebook"></div>
  169.             </body>
  170.  
  171.  
  172.             </html>
  173.           </div>
  174.         </div>
  175.       </div>
  176.     </div>
  177.   </div>
  178.  
  179.   <!-- Second view (for second wrap)-->
  180.   <div id="view-2" class="view tab">
  181.     <!-- We can make with view with navigation, let's add Top Navbar-->
  182.    <div class="navbar">
  183.      <div class="navbar-inner">
  184.        <div class="center sliding">Sports News</div>
  185.      </div>
  186.    </div>
  187.    <div class="pages navbar-through">
  188.      <div data-page="index-2" class="page">
  189.  
  190.        <div class="page-content">
  191.          <!-- REMEMBER YOU NEED TO SHOW THE FEED ON VAR DESC  -->
  192.          <div id="sports">
  193.            <br>
  194.          </div>
  195.          <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  196.          <script>
  197.  
  198.          $.getJSON( "https://newsapi.org/v1/articles?source=espn&sortBy=top&apiKey=4fc83d88b81845b8a492e394a36d82dd", function( data ) {
  199.  
  200.            console.log(data.articles)
  201.            var arrayOfData = data.articles
  202.            for (var i = 0; i < 10; i++) {
  203.              var desc = arrayOfData[i].description;
  204.              var img = arrayOfData[i].urlToImage;
  205.              document.getElementById('sports').innerHTML += '<img height="40px" width="40px" src="'+img+'"/>' + desc + '<br>' ;
  206.            }
  207.  
  208.          });
  209.          </script>
  210.        </div>
  211.  
  212.      </div>
  213.    </div>
  214.  </div>
  215.  
  216.  <div id="view-3" class="view tab">
  217.    <div class="navbar">
  218.      <div class="navbar-inner">
  219.        <div class="center sliding">Business News</div>
  220.      </div>
  221.    </div>
  222.    <div class="pages navbar-through">
  223.      <div data-page="index-3" class="page">
  224.  
  225.        <div class="page-content">
  226.  
  227.          <div id="business">
  228.            <br>
  229.            <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  230.            <script>
  231.  
  232.            $.getJSON( "https://newsapi.org/v1/articles?source=bloomberg&sortBy=top&apiKey=4fc83d88b81845b8a492e394a36d82dd", function( data ) {
  233.  
  234.              console.log(data.articles)
  235.              var arrayOfData = data.articles
  236.              for (var i = 0; i < 10; i++) {
  237.                var desc = arrayOfData[i].description;
  238.                var img = arrayOfData[i].urlToImage;
  239.                document.getElementById('business').innerHTML += '<img height="40px" width="40px" src="'+img+'"/>' + desc + '<br>' ;
  240.              }
  241.  
  242.            });
  243.            </script>
  244.          </div>
  245.  
  246.        </div>
  247.  
  248.      </div>
  249.    </div>
  250.  </div>
  251.  
  252.  <div id="view-4" class="view tab">
  253.    <div class="pages navbar-fixed">
  254.      <div data-page="index-4" class="page">
  255.        <div class="navbar">
  256.          <div class="navbar-inner">
  257.            <div class="center">Finance News</div>
  258.          </div>
  259.        </div>
  260.        <div class="page-content">
  261.  
  262.          <div id="finance">
  263.            <br>
  264.            <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  265.            <script>
  266.  
  267.            $.getJSON( "https://newsapi.org/v1/articles?source=financial-times&sortBy=latest&apiKey=4fc83d88b81845b8a492e394a36d82dd", function(data) {
  268.  
  269.              console.log(data.articles)
  270.              var arrayOfData = data.articles
  271.              for (var i = 0; i < 10; i++) {
  272.                var desc = arrayOfData[i].description;
  273.                var img = arrayOfData[i].urlToImage;
  274.                document.getElementById('finance').innerHTML += '<img height="40px" width="40px" src="'+img+'"/>' + desc + '<br>' ;
  275.              }
  276.  
  277.            });
  278.            </script>
  279.          </div>
  280.  
  281.        </div>
  282.      </div>
  283.  
  284.    </div>
  285.  </div>
  286.  
  287.  <div id="view-5" class="view tab">
  288.    <div class="pages navbar-fixed">
  289.      <div data-page="index-5" class="page">
  290.        <div class="navbar">
  291.          <div class="navbar-inner">
  292.            <div class="center">Your Personal News</div>
  293.          </div>
  294.        </div>
  295.        <div class="page-content">
  296.  
  297.          <div id="top10stories">
  298.            <div class="content-block">
  299.              <p>Breaking News</p>
  300.            </div>
  301.  
  302.            <div id="kylestop">
  303.              kyles top
  304.            </div>
  305.            <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  306.            <script>
  307.            $.get( "http://52.48.79.163/db.php", { type: "top10stories" } )
  308.            .done(function( data ) {
  309.  
  310.              // parse json
  311.              var obj = jQuery.parseJSON(data);
  312.              // print out a story
  313.              //console.log(obj.news.story);
  314.  
  315.  
  316.              var news = obj.news.story
  317.              for (var i = 0 ; i < 10; i++) {
  318.                var desc = news[i];
  319.                document.getElementById('top10stories').innerHTML += desc + '<br>' ;
  320.              }
  321.            });
  322.            </script>
  323.          </div>
  324.          
  325.          <div id="getmystories">
  326.            <div class="content-block">
  327.              <p>My Breaking News</p>
  328.            </div>
  329.                 <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  330.                     <script>
  331.                    
  332.                         $.get( "http://52.48.79.163/db.php?type=getmystories&id=1079006898900009")
  333.                         .done(function( res ) {
  334.  
  335.                         var myJSON = JSON.stringify('Now on the news: <br>' + res + '<br> that is the end of it for now' ); // That's my personal JSON format text
  336.                        
  337.                          // console.log( "get my stories"+ userId )
  338.                           document.getElementById('getmystories').innerHTML += myJSON + '<br>' ;
  339.  
  340.                        
  341.                         });
  342.                 </script>
  343.           </div>
  344.  
  345.           <div id="stories">
  346.                 <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  347.                 <script>
  348.                
  349.                 function saveStory(){
  350.                
  351.                   var data = document.getElementById('story').value;
  352.                   var res = encodeURIComponent(data);
  353.                  
  354.                   $.get( "http://52.48.79.163/db.php", { type: "newstory", id:"1079006898900009", data:res } )
  355.                   .done(function( res ) {
  356.                   });
  357.  
  358.                 }
  359.                 </script>
  360.             <div class="content-block">
  361.               <p> Write your Breaking News Here: </p> <br>
  362.               <input type="text" id="story" size="35"/>
  363.             </div>
  364.             <div class="content-block">
  365.               <button onclick="saveStory()" style="height: 20px; width:150px">Send</button>
  366.             </div>
  367.           </div>
  368.         </div>
  369.       </div>
  370.  
  371.     </div>
  372.   </div>
  373.   <!-- Bottom Tabbar-->
  374.   <div class="toolbar tabbar tabbar-labels">
  375.     <div class="toolbar-inner"><a href="#view-1" class="tab-link active"> <i class="icon tabbar-demo-icon-2"></i><span class="tabbar-label">Login</span></a><a href="#view-2" class="tab-link"><i class="icon tabbar-demo-icon-2"></i><span class="tabbar-label"> Sports</span></a><a href="#view-3" class="tab-link"> <i class="icon tabbar-demo-icon-2"></i><span class="tabbar-label"> Business</span></a><a href="#view-4" class="tab-link"> <i class="icon tabbar-demo-icon-2"></i><span class="tabbar-label"> Financial</span></a></a><a href="#view-5" class="tab-link"> <i class="icon tabbar-demo-icon-2"></i><span class="tabbar-label">Personal News </span></a></div>
  376.   </div>
  377. </div>
  378. <!-- Path to Framework7 Library JS-->
  379. <script type="text/javascript" src="../../dist/js/framework7.min.js"></script>
  380. <!-- Path to your app js-->
  381. <script type="text/javascript" src="js/my-app.js"></script>
  382. </body>
  383. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement