web/client.php
changeset 1436 b3d23c1b791e
parent 1427 8b3d57a519eb
child 1439 df4c992749ea
equal deleted inserted replaced
1435:228471fbc9fa 1436:b3d23c1b791e
     8 
     8 
     9 $rep = $_REQUEST['rep'];
     9 $rep = $_REQUEST['rep'];
    10 include_once __DIR__.'/'.$rep.'/config.php';
    10 include_once __DIR__.'/'.$rep.'/config.php';
    11 
    11 
    12 include_once 'common.php';
    12 include_once 'common.php';
       
    13 
    13 
    14 
    14 /**
    15 /**
    15  * Do we already have a valid Access Token or need to go get one?
    16  * Do we already have a valid Access Token or need to go get one?
    16  */
    17  */
    17 if (!isset($_SESSION['TWITTER_ACCESS_TOKEN']) && isset($_GET['CONNECT']) ) {
    18 if (!isset($_SESSION['TWITTER_ACCESS_TOKEN']) && isset($_GET['CONNECT']) ) {
    50 $videoHeight = ( $embed ? 280 : 320 );
    51 $videoHeight = ( $embed ? 280 : 320 );
    51 if ($embed && !isset($_SESSION['TWITTER_ACCESS_TOKEN']) && (isset($_REQUEST['auth_redirect']) || isset($_SERVER['HTTP_REFERER']))) {
    52 if ($embed && !isset($_SESSION['TWITTER_ACCESS_TOKEN']) && (isset($_REQUEST['auth_redirect']) || isset($_SERVER['HTTP_REFERER']))) {
    52     $_SESSION['TWITTER_REDIRECT_URL'] = isset($_REQUEST['auth_redirect']) ? $_REQUEST['auth_redirect'] : $_SERVER['HTTP_REFERER'];
    53     $_SESSION['TWITTER_REDIRECT_URL'] = isset($_REQUEST['auth_redirect']) ? $_REQUEST['auth_redirect'] : $_SERVER['HTTP_REFERER'];
    53 };
    54 };
    54 
    55 
    55 $annotations = get_default_annotations_config($config, $translate);
    56 $defaultAnnotations = get_default_annotations_config($config, $translate);
       
    57 $annotations = array();
       
    58 foreach ($defaultAnnotations as $annot_cat => $annot_def) {
       
    59     if($annot_cat !== 'default' && !isset($annot_def['colors_class'])) {
       
    60         $annot_def['colors_class'] = 'tweetButton_'.md5($annot_cat);
       
    61     }
       
    62     $annotations[$annot_cat] = $annot_def;
       
    63 }
       
    64 
    56 
    65 
    57 ?>
    66 ?>
    58 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    67 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    59    "http://www.w3.org/TR/html4/strict.dtd">
    68    "http://www.w3.org/TR/html4/strict.dtd">
    60 
    69 
    89     <style>
    98     <style>
    90     video {
    99     video {
    91        width: <?php echo($videoWidth); ?>px;
   100        width: <?php echo($videoWidth); ?>px;
    92        height: <?php echo($videoHeight); ?>px;
   101        height: <?php echo($videoHeight); ?>px;
    93     }
   102     }
       
   103     <?php
       
   104     foreach ($annotations as $annot_cat => $annot_def) {
       
   105         if($annot_cat === 'default') {
       
   106             continue;
       
   107         }
       
   108         $hVal = intval(($annot_def['colors']['h']<1.0)?floatval($annot_def['colors']['h']) * 360.0:$annot_def['colors']['h']);
       
   109         $sVal = intval(floatval($annot_def['colors']['s']) * 100.0);
       
   110 
       
   111         $baseColor = "hsl($hVal, ${sVal}%, 90%)";
       
   112         $borderColor = "hsl($hVal, ${sVal}%, 60%)";
       
   113         $selectedColor = "hsl($hVal, 15%, 70%)";
       
   114         $selectedBorderColor = "hsl($hVal, 15%, 60%)";
       
   115         $gradientColor = "hsl($hVal, ${sVal}%, 50%)";
       
   116     ?>
       
   117     .tweetButton.<?php echo($annot_def['colors_class']) ?> {
       
   118         background: <?php echo($baseColor); ?>;
       
   119         border: solid <?php echo($borderColor); ?> 1px;
       
   120         background-image: -webkit-linear-gradient(top, <?php echo($baseColor); ?>, <?php echo($gradientColor); ?>);
       
   121         background-image: -moz-linear-gradient(top, <?php echo($baseColor); ?>, <?php echo($gradientColor); ?>);
       
   122         background-image: -ms-linear-gradient(top, <?php echo($baseColor); ?>, <?php echo($gradientColor); ?>);
       
   123         background-image: -o-linear-gradient(top, <?php echo($baseColor); ?>, <?php echo($gradientColor); ?>);
       
   124         background-image: linear-gradient(to bottom, <?php echo($baseColor); ?>, <?php echo($gradientColor); ?>);
       
   125     }
       
   126     .tweetButton.<?php echo($annot_def['colors_class']) ?>.selected,.tweetButton:active.<?php echo($annot_def['colors_class']) ?>:active,.tweetButton:hover.<?php echo($annot_def['colors_class']) ?>:hover.selected {
       
   127         background: <?php echo($selectedColor); ?>;
       
   128         border: solid <?php echo($selectedBorderColor); ?> 1px;
       
   129     }
       
   130     .tweetButton.<?php echo($annot_def['colors_class']) ?>:hover {
       
   131         background-image: -webkit-linear-gradient(top, <?php echo($gradientColor); ?>, <?php echo($baseColor); ?>);
       
   132         background-image: -moz-linear-gradient(top, <?php echo($gradientColor); ?>, <?php echo($baseColor); ?>);
       
   133         background-image: -ms-linear-gradient(top, <?php echo($gradientColor); ?>, <?php echo($baseColor); ?>);
       
   134         background-image: -o-linear-gradient(top, <?php echo($gradientColor); ?>, <?php echo($baseColor); ?>);
       
   135         background-image: linear-gradient(to bottom, <?php echo($gradientColor); ?>, <?php echo($baseColor); ?>);
       
   136     }
       
   137     <?php } ?>
    94     </style>
   138     </style>
    95 
   139 
    96     <script type="text/javascript">
   140     <script type="text/javascript">
    97         <?php
   141         <?php
    98         if (isset($config['tracking_keywords']) && count($config['tracking_keywords'])) {
   142         if (isset($config['tracking_keywords']) && count($config['tracking_keywords'])) {
   110                 if("keywords" in annotations[annot_cat]) {
   154                 if("keywords" in annotations[annot_cat]) {
   111                     annotations[annot_cat]['keywords'] = [ new RegExp(annotations[annot_cat]['keywords']), ];
   155                     annotations[annot_cat]['keywords'] = [ new RegExp(annotations[annot_cat]['keywords']), ];
   112                 }
   156                 }
   113             }
   157             }
   114         }
   158         }
   115         console.log(annotations);
       
   116     </script>
   159     </script>
   117     <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])) { ?>
   160     <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])) { ?>
   118     <script type="text/javascript" src="<?php echo(registry_url('twcx-main','js'))?>"></script>
   161     <script type="text/javascript" src="<?php echo(registry_url('twcx-main','js'))?>"></script>
   119     <?php } ?>
   162     <?php } ?>
   120 
   163