Search Unity

Easy get server time using google script

Discussion in 'Scripting' started by PrisonerOfLies, Oct 16, 2015.

  1. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    2.png 4.png 5.png 6.png 7.png

    this will return the string of datetime in Unity format :)
    just use DateTime.Parse()

    how to use it in unity ?
    Lets get started
    1. Create a C# script called EZ_Time
    2. Code (CSharp):
      1. using UnityEngine;
      2. using System;
      3. using System.Collections;
      4.  
      5. public static class EZ_Time
      6. {
      7.     public static float timeout = 5;
      8.  
      9.     public static DateTime myDateTime;
      10.     public static bool noInternet;
      11.     public static bool isReady;
      12.  
      13.     public static TimeSpan LocalTimeMinusServerTime;
      14.    
      15.     /// <summary>
      16.     /// Get the server time from the url.
      17.     /// Must be called in a coroutine function and with StartCorutine and yield the result so that the execution will wait for it
      18.     /// to finish before going on to execute the rest of the code below.
      19.     /// </summary>
      20.     /// <param name="url"></param>
      21.     /// <returns></returns>
      22.     public static IEnumerator GetServerTime(string url)
      23.     {
      24.         Debug.Log("Getting server time..");
      25.         isReady = false;
      26.  
      27.         WWW link = new WWW(url);
      28.         yield return link;
      29.  
      30.         float startTime = Time.unscaledTime;
      31.  
      32.         noInternet = false;
      33.  
      34.         while (link.error != null)
      35.         {
      36.             Debug.Log("!link.isDone..");
      37.             if ((Time.unscaledTime - timeout) > startTime)
      38.             {
      39.                 Debug.Log("it's taking too long. i am giving up..");
      40.                 noInternet = true;
      41.                
      42.                 break;
      43.             }
      44.             yield return new WaitForEndOfFrame();
      45.         }
      46.  
      47.         if (!noInternet)
      48.         {
      49.             string time = link.text;
      50.             myDateTime = DateTime.Parse(time);
      51.             LocalTimeMinusServerTime = DateTime.Now - myDateTime;
      52.             isReady = true;
      53.         }
      54.         else
      55.         {
      56.             myDateTime = DateTime.Now;
      57.             LocalTimeMinusServerTime = TimeSpan.Zero;
      58.             isReady = true;
      59.         }
      60.  
      61.         yield return new WaitForEndOfFrame();
      62.     }
      63.  
      64.     /// <summary>
      65.     /// Return the server time using localTime + offset. Faster than quering the web again for server time.
      66.     /// For this to work well, must make sure GetServerTime has finished before calling this function.
      67.     /// </summary>
      68.     /// <param name="localTime"></param>
      69.     /// <returns></returns>
      70.     public static DateTime ConvertLocalToServerTime(DateTime localTime)
      71.     {
      72.         return localTime - LocalTimeMinusServerTime;
      73.     }
      74. }
      75.  
    3. create another script called EZ_TimeInitialize and attach it to a gameObject in the scene.
    4. Code (CSharp):
      1. using UnityEngine;
      2. using System.Collections;
      3.  
      4. public class EZ_TimeInitialize : MonoBehaviour
      5. {
      6.     public string url = "https://script.google.com/macros/s/AKfycbwnUNuHBYbWODhy6wQ8H4JxRgGHqE-LPpk_CZhEuBkLMvfAd8U/exec";
      7.     public static bool isInitialized = false;
      8.  
      9.     void Awake()
      10.     {
      11.         DontDestroyOnLoad(this.gameObject);
      12.     }
      13.    
      14.     //Get the server time again. just in case of cheat
      15.     void OnApplicationFocus(bool focusStatus)
      16.     {
      17.         if (focusStatus)
      18.         {
      19.             Debug.LogWarning("EZ_TimeInitialize Gain focus");
      20.             StopAllCoroutines();
      21.             StartCoroutine(Init());
      22.         }
      23.         else
      24.         {
      25.             isInitialized = false;
      26.         }
      27.     }
      28.    
      29.     IEnumerator Init()
      30.     {
      31.         yield return StartCoroutine(EZ_Time.GetServerTime(url));
      32.         Debug.Log("EZ_Time.GetServerTime completed.");
      33.         isInitialized = true;
      34.     }
      35. }
      36.  
    5. that's it ! the datetime variable can be accessed anywhere in the project by using EZ_Time.myDateTime

    last but not least, support our new asset https://www.assetstore.unity3d.com/en/#!/content/45956

    the google app script

    Code (JavaScript):
    1. function doGet(request)
    2. {
    3.   var output = ContentService.createTextOutput();
    4.  
    5.   var d = new Date();
    6.    
    7.   //Unity format
    8.   var dateofDay = new Date(d.getTime());
    9.   var formattedDate = Utilities.formatDate(new Date(), "GMT+8", "MM/dd/yyyy HH:mm:ss a");
    10.  
    11.   output.setContent(formattedDate);
    12.  
    13.   return output;  
    14. }
    15.  
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Two criticisms; one that limits the script's usefulness, and both limit its ease of use.

    1) Involving a Google Docs script in this drastically overcomplicates this concept. And there are limits to how much server time Google is willing to put into a docs script; if your game gets any amount of traction, this script would basically just stop working for a certain number of hours out of the day. (Don't get me wrong; I get the "This uses a technology that I know, therefore this is the technique I'm going to use"; it's just that you're hammering in a screw because you haven't learned to use a screwdriver.)

    There are a million servers out there with pages that do nothing but spit back the time, and if you have a web server that supports PHP or any sort of server side scripting, it's also the easiest "hello world" project you can make. I recommend learning to use one of these, instead.

    2) There is no reason to have two classes here. There's also no need to require the user to put anything in the scene at all. If you combine these into one script, you can make it a singleton that creates itself on demand.
     
  3. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    I have to agree with point 1. However, this method is an alternative for small games that need to get server time but the developers don't want to spend money to host a web that can be coded to spit back time.

    For your point 2, yes gameobject with the script can be created in runtime on demand, however, the reason i have a persistent gameobject is to handle the ApplicationFocus where the player tabbed out of game. Anything can happen such as cheating by changing the system clock. So i will always request the server time again when player tabbed back to game.
    *Note that I am using time offset to convert local time to server time for optimization.
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    You can do the exact same thing with a singleton that spawns its own instance the first time the server time is requested.
     
  5. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    ok you're right
     
  6. Aseemy

    Aseemy

    Joined:
    Aug 22, 2015
    Posts:
    207
    I was planning on using this method, but since you say using a server side script is a better way. can you provide me a link to a tutorial that teaches that, i'd like to learn php and do that. i have seen basic php tutorials on w3schools but i dont see (maybe i am stupid and its there) anything like you say.
     
  7. Aseemy

    Aseemy

    Joined:
    Aug 22, 2015
    Posts:
    207
    For anyone wondering:
    I made a PHP script, was really easy once i found it on w3schools.


    XML - crossdomain.xml
    Unity requires that websites you want to access via a WWW Request have a cross domain policy.
    Code (XML):
    1. <?xml version="1.0"?>
    2. <cross-domain-policy>
    3. <allow-access-from domain="*"/>
    4. </cross-domain-policy>
    Upload this file to the root of your web server.

    PHP - servertime.php
    This script returns the number of days passed since the beginning of the year.
    Code (CSharp):
    1. <?php
    2.     $mydate=getdate(date("U"));
    3.     echo "$mydate[yday]";
    4. ?>
    Now just compare the values to see if a day has passed.
    Credits : http://wiki.unity3d.com/index.php?title=Server_Side_Highscores#Step_3:_The_Unity_HSController_Script
     
  8. cstlmode

    cstlmode

    Joined:
    Dec 2, 2014
    Posts:
    88
  9. Aseemy

    Aseemy

    Joined:
    Aug 22, 2015
    Posts:
    207
  10. cstlmode

    cstlmode

    Joined:
    Dec 2, 2014
    Posts:
    88
    @Aseemy thanx alot , i'll try this free php server option after i make this work , i used the methode above but i'm getting an error in the parsing section it says , formatExcetion : String not recognized as a valid DateTime ,
    the display looks correct to me ,i don't know why it says , it's not recognized can someone help please !!!
    here is the code

    Code (JavaScript):
    1. #pragma strict
    2. import System;
    3.  
    4.  
    5.  
    6. function Start () {
    7. // InvokeRepeating("checkGlobalTime",0,5);
    8.  
    9.      checkGlobalTime();
    10. }
    11.  
    12. function checkGlobalTime(){
    13.     var url = "https://script.google.com/macros/s/AKfycbxt6LTH0jSogfODvnCdWcqGTfQBnlGk61lXyQp_AjCmyb0HqBLF/exec";
    14.     var request = WWW(url);
    15.     yield request;
    16.     if(request.error!=null){
    17.         Debug.Log("Issues in connection");
    18.         return;}
    19.  
    20.     else{ var  TimeFromServer :String =request.text;
    21.     var globalTime :DateTime;
    22.     globalTime= DateTime.Parse(TimeFromServer);
    23.  
    24.    // DateTime.TryParse(StringTime,globalTime);
    25.         Debug.Log("Internet Time :"+globalTime);
    26.     }
    27. }
    28.  
     
  11. Aseemy

    Aseemy

    Joined:
    Aug 22, 2015
    Posts:
    207
    request.text is not returning correct value.

    Code (CSharp):
    1. Debug.Log(request.text);
    This returns
    Code (CSharp):
    1. <!DOCTYPE html>
    2. <html lang="en">
    3.   <head>
    4.   <meta charset="utf-8">
    5.   <meta content="width=300, initial-scale=1" name="viewport">
    6.   <meta name="description" content="Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.">
    7.   <meta name="google-site-verification" content="LrdTUW9psUAMbh4Ia074-BPEVmcpBxF6Gwf0MSgQXZs">
    8.   <title>Meet Google Drive – One place for all your files</title>
    9.   <style>
    10.   @font-face {
    11.   font-family: 'Open Sans';
    12.   font-style: normal;
    13.   font-weight: 300;
    14.   src: local('Open Sans Light'), local('OpenSans-Light'), url(//fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTYnF5uFdDttMLvmWuJdhhgs.ttf) format('truetype');
    15. }
    16. @font-face {
    17.   font-family: 'Open Sans';
    18.   font-style: normal;
    19.   font-weight: 400;
    20.   src: local('Open Sans'), local('OpenSans'), url(//fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf) format('truetype');
    21. }
    22.   </style>
    23.   <style>
    24.   h1, h2 {
    25.   -webkit-animation-duration: 0.1s;
    26.   -webkit-animation-name: fontfix;
    27.   -webkit-animation-iteration-count: 1;
    28.   -webkit-animation-timing-function: linear;
    29.   -webkit-animation-delay: 0;
    30.   }
    31.   @-webkit-keyframes fontfix {
    32.   from {
    33.   opacity: 1;
    34.   }
    35.   to {
    36.   opacity: 1;
    37.   }
    38.   }
    39.   </style>
    40. <style>
    41.   html, body {
    42.   font-family: Arial, sans-serif;
    43.   background: #fff;
    44.   margin: 0;
    45.   padding: 0;
    46.   border: 0;
    47.   position: absolute;
    48.   height: 100%;
    49.   min-width: 100%;
    50.   font-size: 13px;
    51.   color: #404040;
    52.   direction: ltr;
    53.   -webkit-text-size-adjust: none;
    54.   }
    55.   button,
    56.   input[type=button],
    57.   input[type=submit] {
    58.   font-family: Arial, sans-serif;
    59.   font-size: 13px;
    60.   }
    61.   a,
    62.   a:hover,
    63.   a:visited {
    64.   color: #427fed;
    65.   cursor: pointer;
    66.   text-decoration: none;
    67.   }
    68.   a:hover {
    69.   text-decoration: underline;
    70.   }
    71.   h1 {
    72.   font-size: 20px;
    73.   color: #262626;
    74.   margin: 0 0 15px;
    75.   font-weight: normal;
    76.   }
    77.   h2 {
    78.   font-size: 14px;
    79.   color: #262626;
    80.   margin: 0 0 15px;
    81.   font-weight: bold;
    82.   }
    83.   input[type=email],
    84.   input[type=number],
    85.   input[type=password],
    86.   input[type=tel],
    87.   input[type=text],
    88.   input[type=url] {
    89.   -moz-appearance: none;
    90.   -webkit-appearance: none;
    91.   appearance: none;
    92.   display: inline-block;
    93.   height: 36px;
    94.   padding: 0 8px;
    95.   margin: 0;
    96.   background: #fff;
    97.   border: 1px solid #d9d9d9;
    98.   border-top: 1px solid #c0c0c0;
    99.   -moz-box-sizing: border-box;
    100.   -webkit-box-sizing: border-box;
    101.   box-sizing: border-box;
    102.   -moz-border-radius: 1px;
    103.   -webkit-border-radius: 1px;
    104.   border-radius: 1px;
    105.   font-size: 15px;
    106.   color: #404040;
    107.   }
    108.   input[type=email]:hover,
    109.   input[type=number]:hover,
    110.   input[type=password]:hover,
    111.   input[type=tel]:hover,
    112.   input[type=text]:hover,
    113.   input[type=url]:hover {
    114.   border: 1px solid #b9b9b9;
    115.   border-top: 1px solid #a0a0a0;
    116.   -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    117.   -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    118.   box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    119.   }
    120.   input[type=email]:focus,
    121.   input[type=number]:focus,
    122.   input[type=password]:focus,
    123.   input[type=tel]:focus,
    124.   input[type=text]:focus,
    125.   input[type=url]:focus {
    126.   outline: none;
    127.   border: 1px solid #4d90fe;
    128.   -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    129.   -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    130.   box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    131.   }
    132.   input[type=checkbox],
    133.   input[type=radio] {
    134.   -webkit-appearance: none;
    135.   display: inline-block;
    136.   width: 13px;
    137.   height: 13px;
    138.   margin: 0;
    139.   cursor: pointer;
    140.   vertical-align: bottom;
    141.   background: #fff;
    142.   border: 1px solid #c6c6c6;
    143.   -moz-border-radius: 1px;
    144.   -webkit-border-radius: 1px;
    145.   border-radius: 1px;
    146.   -moz-box-sizing: border-box;
    147.   -webkit-box-sizing: border-box;
    148.   box-sizing: border-box;
    149.   position: relative;
    150.   }
    151.   input[type=checkbox]:active,
    152.   input[type=radio]:active {
    153.   background: #ebebeb;
    154.   }
    155.   input[type=checkbox]:hover {
    156.   border-color: #c6c6c6;
    157.   -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    158.   -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    159.   box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    160.   }
    161.   input[type=radio] {
    162.   -moz-border-radius: 1em;
    163.   -webkit-border-radius: 1em;
    164.   border-radius: 1em;
    165.   width: 15px;
    166.   height: 15px;
    167.   }
    168.   input[type=checkbox]:checked,
    169.   input[type=radio]:checked {
    170.   background: #fff;
    171.   }
    172.   input[type=radio]:checked::after {
    173.   content: '';
    174.   display: block;
    175.   position: relative;
    176.   top: 3px;
    177.   left: 3px;
    178.   width: 7px;
    179.   height: 7px;
    180.   background: #666;
    181.   -moz-border-radius: 1em;
    182.   -webkit-border-radius: 1em;
    183.   border-radius: 1em;
    184.   }
    185.   input[type=checkbox]:checked::after {
    186.   content: url(https://ssl.gstatic.com/ui/v1/menu/checkmark.png);
    187.   display: block;
    188.   position: absolute;
    189.   top: -6px;
    190.   left: -5px;
    191.   }
    192.   input[type=checkbox]:focus {
    193.   outline: none;
    194.   border-color: #4d90fe;
    195.   }
    196.   .stacked-label {
    197.   display: block;
    198.   font-weight: bold;
    199.   margin: .5em 0;
    200.   }
    201.   .hidden-label {
    202.   position: absolute !important;
    203.   clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
    204.   clip: rect(1px, 1px, 1px, 1px);
    205.   height: 0px;
    206.   width: 0px;
    207.   overflow: hidden;
    208.   visibility: hidden;
    209.   }
    210.   input[type=checkbox].form-error,
    211.   input[type=email].form-error,
    212.   input[type=number].form-error,
    213.   input[type=password].form-error,
    214.   input[type=text].form-error,
    215.   input[type=tel].form-error,
    216.   input[type=url].form-error {
    217.   border: 1px solid #dd4b39;
    218.   }
    219.   .error-msg {
    220.   margin: .5em 0;
    221.   display: block;
    222.   color: #dd4b39;
    223.   line-height: 17px;
    224.   }
    225.   .help-link {
    226.   background: #dd4b39;
    227.   padding: 0 5px;
    228.   color: #fff;
    229.   font-weight: bold;
    230.   display: inline-block;
    231.   -moz-border-radius: 1em;
    232.   -webkit-border-radius: 1em;
    233.   border-radius: 1em;
    234.   text-decoration: none;
    235.   position: relative;
    236.   top: 0px;
    237.   }
    238.   .help-link:visited {
    239.   color: #fff;
    240.   }
    241.   .help-link:hover {
    242.   color: #fff;
    243.   background: #c03523;
    244.   text-decoration: none;
    245.   }
    246.   .help-link:active {
    247.   opacity: 1;
    248.   background: #ae2817;
    249.   }
    250.   .wrapper {
    251.   position: relative;
    252.   min-height: 100%;
    253.   }
    254.   .content {
    255.   padding: 0 44px;
    256.   }
    257.   .main {
    258.   padding-bottom: 100px;
    259.   }
    260.   /* For modern browsers */
    261.   .clearfix:before,
    262.   .clearfix:after {
    263.   content: "";
    264.   display: table;
    265.   }
    266.   .clearfix:after {
    267.   clear: both;
    268.   }
    269.   /* For IE 6/7 (trigger hasLayout) */
    270.   .clearfix {
    271.   zoom:1;
    272.   }
    273.   .google-header-bar {
    274.   height: 71px;
    275.   border-bottom: 1px solid #e5e5e5;
    276.   overflow: hidden;
    277.   }
    278.   .header .logo {
    279.   background-image: url(https://ssl.gstatic.com/accounts/ui/logo_1x.png);
    280.   background-size: 116px 38px;
    281.   background-repeat: no-repeat;
    282.   margin: 17px 0 0;
    283.   float: left;
    284.   height: 38px;
    285.   width: 116px;
    286.   }
    287.   .header .logo-w {
    288.   background-image: url(https://ssl.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_112x36dp.png);
    289.   background-size: 112px 36px;
    290.   margin: 21px 0 0;
    291.   }
    292.   .header .secondary-link {
    293.   margin: 28px 0 0;
    294.   float: right;
    295.   }
    296.   .header .secondary-link a {
    297.   font-weight: normal;
    298.   }
    299.   .google-header-bar.centered {
    300.   border: 0;
    301.   height: 108px;
    302.   }
    303.   .google-header-bar.centered .header .logo {
    304.   float: none;
    305.   margin: 40px auto 30px;
    306.   display: block;
    307.   }
    308.   .google-header-bar.centered .header .secondary-link {
    309.   display: none
    310.   }
    311.   .google-footer-bar {
    312.   position: absolute;
    313.   bottom: 0;
    314.   height: 35px;
    315.   width: 100%;
    316.   border-top: 1px solid #e5e5e5;
    317.   overflow: hidden;
    318.   }
    319.   .footer {
    320.   padding-top: 7px;
    321.   font-size: .85em;
    322.   white-space: nowrap;
    323.   line-height: 0;
    324.   }
    325.   .footer ul {
    326.   float: left;
    327.   max-width: 80%;
    328.   min-height: 16px;
    329.   padding: 0;
    330.   }
    331.   .footer ul li {
    332.   color: #737373;
    333.   display: inline;
    334.   padding: 0;
    335.   padding-right: 1.5em;
    336.   }
    337.   .footer a {
    338.   color: #737373;
    339.   }
    340.   .lang-chooser-wrap {
    341.   float: right;
    342.   display: inline;
    343.   }
    344.   .lang-chooser-wrap img {
    345.   vertical-align: top;
    346.   }
    347.   .lang-chooser {
    348.   font-size: 13px;
    349.   height: 24px;
    350.   line-height: 24px;
    351.   }
    352.   .lang-chooser option {
    353.   font-size: 13px;
    354.   line-height: 24px;
    355.   }
    356.   .hidden {
    357.   height: 0px;
    358.   width: 0px;
    359.   overflow: hidden;
    360.   visibility: hidden;
    361.   display: none !important;
    362.   }
    363.   .banner {
    364.   text-align: center;
    365.   }
    366.   .card {
    367.   background-color: #f7f7f7;
    368.   padding: 20px 25px 30px;
    369.   margin: 0 auto 25px;
    370.   width: 304px;
    371.   -moz-border-radius: 2px;
    372.   -webkit-border-radius: 2px;
    373.   border-radius: 2px;
    374.   -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
    375.   -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
    376.   box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
    377.   }
    378.   .card > *:first-child {
    379.   margin-top: 0;
    380.   }
    381.   .rc-button,
    382.   .rc-button:visited {
    383.   display: inline-block;
    384.   min-width: 46px;
    385.   text-align: center;
    386.   color: #444;
    387.   font-size: 14px;
    388.   font-weight: 700;
    389.   height: 36px;
    390.   padding: 0 8px;
    391.   line-height: 36px;
    392.   -moz-border-radius: 3px;
    393.   -webkit-border-radius: 3px;
    394.   border-radius: 3px;
    395.   -o-transition: all 0.218s;
    396.   -moz-transition: all 0.218s;
    397.   -webkit-transition: all 0.218s;
    398.   transition: all 0.218s;
    399.   border: 1px solid #dcdcdc;
    400.   background-color: #f5f5f5;
    401.   background-image: -webkit-linear-gradient(top,#f5f5f5,#f1f1f1);
    402.   background-image: -moz-linear-gradient(top,#f5f5f5,#f1f1f1);
    403.   background-image: -ms-linear-gradient(top,#f5f5f5,#f1f1f1);
    404.   background-image: -o-linear-gradient(top,#f5f5f5,#f1f1f1);
    405.   background-image: linear-gradient(top,#f5f5f5,#f1f1f1);
    406.   -o-transition: none;
    407.   -moz-user-select: none;
    408.   -webkit-user-select: none;
    409.   user-select: none;
    410.   cursor: default;
    411.   }
    412.   .card .rc-button {
    413.   width: 100%;
    414.   padding: 0;
    415.   }
    416.   .rc-button.disabled,
    417.   .rc-button[disabled] {
    418.   opacity: .5;
    419.   filter: alpha(opacity=50);
    420.   cursor: default;
    421.   pointer-events: none;
    422.   }
    423.   .rc-button:hover {
    424.   border: 1px solid #c6c6c6;
    425.   color: #333;
    426.   text-decoration: none;
    427.   -o-transition: all 0.0s;
    428.   -moz-transition: all 0.0s;
    429.   -webkit-transition: all 0.0s;
    430.   transition: all 0.0s;
    431.   background-color: #f8f8f8;
    432.   background-image: -webkit-linear-gradient(top,#f8f8f8,#f1f1f1);
    433.   background-image: -moz-linear-gradient(top,#f8f8f8,#f1f1f1);
    434.   background-image: -ms-linear-gradient(top,#f8f8f8,#f1f1f1);
    435.   background-image: -o-linear-gradient(top,#f8f8f8,#f1f1f1);
    436.   background-image: linear-gradient(top,#f8f8f8,#f1f1f1);
    437.   -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    438.   -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    439.   box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    440.   }
    441.   .rc-button:active {
    442.   background-color: #f6f6f6;
    443.   background-image: -webkit-linear-gradient(top,#f6f6f6,#f1f1f1);
    444.   background-image: -moz-linear-gradient(top,#f6f6f6,#f1f1f1);
    445.   background-image: -ms-linear-gradient(top,#f6f6f6,#f1f1f1);
    446.   background-image: -o-linear-gradient(top,#f6f6f6,#f1f1f1);
    447.   background-image: linear-gradient(top,#f6f6f6,#f1f1f1);
    448.   -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    449.   -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    450.   box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    451.   }
    452.   .rc-button-submit,
    453.   .rc-button-submit:visited {
    454.   border: 1px solid #3079ed;
    455.   color: #fff;
    456.   text-shadow: 0 1px rgba(0,0,0,0.1);
    457.   background-color: #4d90fe;
    458.   background-image: -webkit-linear-gradient(top,#4d90fe,#4787ed);
    459.   background-image: -moz-linear-gradient(top,#4d90fe,#4787ed);
    460.   background-image: -ms-linear-gradient(top,#4d90fe,#4787ed);
    461.   background-image: -o-linear-gradient(top,#4d90fe,#4787ed);
    462.   background-image: linear-gradient(top,#4d90fe,#4787ed);
    463.   }
    464.   .rc-button-submit:hover {
    465.   border: 1px solid #2f5bb7;
    466.   color: #fff;
    467.   text-shadow: 0 1px rgba(0,0,0,0.3);
    468.   background-color: #357ae8;
    469.   background-image: -webkit-linear-gradient(top,#4d90fe,#357ae8);
    470.   background-image: -moz-linear-gradient(top,#4d90fe,#357ae8);
    471.   background-image: -ms-linear-gradient(top,#4d90fe,#357ae8);
    472.   background-image: -o-linear-gradient(top,#4d90fe,#357ae8);
    473.   background-image: linear-gradient(top,#4d90fe,#357ae8);
    474.   }
    475.   .rc-button-submit:active {
    476.   background-color: #357ae8;
    477.   background-image: -webkit-linear-gradient(top,#4d90fe,#357ae8);
    478.   background-image: -moz-linear-gradient(top,#4d90fe,#357ae8);
    479.   background-image: -ms-linear-gradient(top,#4d90fe,#357ae8);
    480.   background-image: -o-linear-gradient(top,#4d90fe,#357ae8);
    481.   background-image: linear-gradient(top,#4d90fe,#357ae8);
    482.   -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    483.   -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    484.   box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    485.   }
    486.   .rc-button-red,
    487.   .rc-button-red:visited {
    488.   border: 1px solid transparent;
    489.   color: #fff;
    490.   text-shadow: 0 1px rgba(0,0,0,0.1);
    491.   background-color: #d14836;
    492.   background-image: -webkit-linear-gradient(top,#dd4b39,#d14836);
    493.   background-image: -moz-linear-gradient(top,#dd4b39,#d14836);
    494.   background-image: -ms-linear-gradient(top,#dd4b39,#d14836);
    495.   background-image: -o-linear-gradient(top,#dd4b39,#d14836);
    496.   background-image: linear-gradient(top,#dd4b39,#d14836);
    497.   }
    498.   .rc-button-red:hover {
    499.   border: 1px solid #b0281a;
    500.   color: #fff;
    501.   text-shadow: 0 1px rgba(0,0,0,0.3);
    502.   background-color: #c53727;
    503.   background-image: -webkit-linear-gradient(top,#dd4b39,#c53727);
    504.   background-image: -moz-linear-gradient(top,#dd4b39,#c53727);
    505.   background-image: -ms-linear-gradient(top,#dd4b39,#c53727);
    506.   background-image: -o-linear-gradient(top,#dd4b39,#c53727);
    507.   background-image: linear-gradient(top,#dd4b39,#c53727);
    508.   }
    509.   .rc-button-red:active {
    510.   border: 1px solid #992a1b;
    511.   background-color: #b0281a;
    512.   background-image: -webkit-linear-gradient(top,#dd4b39,#b0281a);
    513.   background-image: -moz-linear-gradient(top,#dd4b39,#b0281a);
    514.   background-image: -ms-linear-gradient(top,#dd4b39,#b0281a);
    515.   background-image: -o-linear-gradient(top,#dd4b39,#b0281a);
    516.   background-image: linear-gradient(top,#dd4b39,#b0281a);
    517.   -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    518.   -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    519.   box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    520.   }
    521.   .secondary-actions {
    522.   text-align: center;
    523.   }
    524. </style>
    525. <style media="screen and (max-width: 800px), screen and (max-height: 800px)">
    526.   .google-header-bar.centered {
    527.   height: 83px;
    528.   }
    529.   .google-header-bar.centered .header .logo {
    530.   margin: 25px auto 20px;
    531.   }
    532.   .card {
    533.   margin-bottom: 20px;
    534.   }
    535. </style>
    536. <style media="screen and (max-width: 580px)">
    537.   html, body {
    538.   font-size: 14px;
    539.   }
    540.   .google-header-bar.centered {
    541.   height: 73px;
    542.   }
    543.   .google-header-bar.centered .header .logo {
    544.   margin: 20px auto 15px;
    545.   }
    546.   .content {
    547.   padding-left: 10px;
    548.   padding-right: 10px;
    549.   }
    550.   .hidden-small {
    551.   display: none;
    552.   }
    553.   .card {
    554.   padding: 20px 15px 30px;
    555.   width: 270px;
    556.   }
    557.   .footer ul li {
    558.   padding-right: 1em;
    559.   }
    560.   .lang-chooser-wrap {
    561.   display: none;
    562.   }
    563. </style>
    564. <style media="screen and (-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3 / 2), (min-device-pixel-ratio: 1.5)">
    565.   .header .logo {
    566.   background-image: url(https://ssl.gstatic.com/accounts/ui/logo_2x.png);
    567.   }
    568.   .header .logo-w {
    569.   background-image: url(https://ssl.gstatic.com/images/branding/googlelogo/2x/googlelogo_color_112x36dp.png);
    570.   }
    571. </style>
    572. <style>
    573.   pre.debug {
    574.   font-family: monospace;
    575.   position: absolute;
    576.   left: 0;
    577.   margin: 0;
    578.   padding: 1.5em;
    579.   font-size: 13px;
    580.   background: #f1f1f1;
    581.   border-top: 1px solid #e5e5e5;
    582.   direction: ltr;
    583.   white-space: pre-wrap;
    584.   width: 90%;
    585.   overflow: hidden;
    586.   }
    587. </style>
    588. <style>
    589.   .banner h1 {
    590.   font-family: 'Open Sans', arial;
    591.   -webkit-font-smoothing: antialiased;
    592.   color: #555;
    593.   font-size: 42px;
    594.   font-weight: 300;
    595.   margin-top: 0;
    596.   margin-bottom: 20px;
    597.   }
    598.   .banner h2 {
    599.   font-family: 'Open Sans', arial;
    600.   -webkit-font-smoothing: antialiased;
    601.   color: #555;
    602.   font-size: 18px;
    603.   font-weight: 400;
    604.   margin-bottom: 20px;
    605.   }
    606.   .signin-card {
    607.   width: 274px;
    608.   padding: 40px 40px;
    609.   }
    610.   .signin-card .profile-img {
    611.   width: 96px;
    612.   height: 96px;
    613.   margin: 0 auto 10px;
    614.   display: block;
    615.   -moz-border-radius: 50%;
    616.   -webkit-border-radius: 50%;
    617.   border-radius: 50%;
    618.   }
    619.   .signin-card .profile-name {
    620.   font-size: 16px;
    621.   font-weight: bold;
    622.   text-align: center;
    623.   margin: 10px 0 0;
    624.   min-height: 1em;
    625.   }
    626.   .signin-card .profile-email {
    627.   font-size: 16px;
    628.   text-align: center;
    629.   margin: 10px 0 20px 0;
    630.   min-height: 1em;
    631.   }
    632.   .signin-card input[type=email],
    633.   .signin-card input[type=password],
    634.   .signin-card input[type=text],
    635.   .signin-card input[type=submit] {
    636.   width: 100%;
    637.   display: block;
    638.   margin-bottom: 10px;
    639.   z-index: 1;
    640.   position: relative;
    641.   -moz-box-sizing: border-box;
    642.   -webkit-box-sizing: border-box;
    643.   box-sizing: border-box;
    644.   }
    645.   .signin-card #Email,
    646.   .signin-card #Passwd,
    647.   .signin-<message truncated>
     
  12. cstlmode

    cstlmode

    Joined:
    Dec 2, 2014
    Posts:
    88
    @Aseemy thanx , seams like the page contain more than a string , please correct me if i'm wrong ,