Commit 9ae7b282 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

initial

parent c71c0a09
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Elphel on GitHub</title>
<script src="js/jquery-3.1.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/elphel_messenger.js"></script>
<script src="js/github.js"></script>
<link rel="stylesheet" href="js/github.css">
</head>
<body>
<div id="head"></div>
<div id="content"></div>
<script>
ElphelMessenger.init();
</script>
</body>
</html>
\ No newline at end of file
<!doctype html>
<html lang="en">
<head>
</head>
<body>
<div id="help-text">
<h2>Welcome to Elphel</h2>
<i><p>Elphel high performance cameras are free software and hardware designs. Freedom of the users of Elphel products is our top priority - we value and protect it with the <a href='http://www.gnu.org/licenses/gpl.html'><b>GNU General Public License</b></a> that covers all the Elphel software and hardware designs. In 2011 CERN Open Hardware License became available for hardware products and since then Elphel cameras are distributed under <a href='http://www.ohwr.org/projects/cernohl'><b>CERN OHLv1.1</b></a> or newer.</p>
<p>Elphel uses multiple web applications for different activities, each application has its own navigation and internal logic. This page plays a role of a virtual desktop with multiple windows - one for each application. This page search launches simultaneous requests to each application and shows number of results found by each of the applications: Main Website, Development Blog, Wiki (Documentation), Mailing List Archive and Git Repository.</p>
<p>We hope you will find the new sites organization easier to navigate. Please feel free to comment and leave suggestions on our public mailing list.</p>
<p>Elphel team</p></i>
<img title='Home' style='cursor:pointer;' width=40 height=40 src='images/elphel-logo.png'>
<br/>
<br/>
<p>Help:</p>
<table>
<tr>
<td valign='top'>&bull;</td>
<td valign='top'><b>Main</b></td>
<td>Elphel's main website talks about our company, people and products.</td>
</tr>
<tr>
<td valign='top'>&bull;</td>
<td valign='top'><b>Blog</b></td>
<td>On the blog you can read in depth about current projects, find news and events announcements.</td>
</tr>
<tr>
<td valign='top'>&bull;</td>
<td valign='top'><b>Wiki</b></td>
<td>Wiki is for documentation, camera schematics, and parts download - all under GNU GPL and Open Hardware Licence.</td>
</tr>
<tr>
<td valign='top'>&bull;</td>
<td valign='top'><b>Support&nbsp;</b></td>
<td>Mail Archive is a very helpful resource for technical questions, frequently asked as well as rare ones. Searching in archive is the best start if you need help using the camera or developing your application - it is likely that somebody had similar problem and figured this out.</td>
</tr>
<tr>
<td valign='top'>&bull;</td>
<td valign='top'><b>Code</b></td>
<td>All of our software and FPGA projects are hosted at <b><i>https://git.elphel.com</i></b> - available for download under GNU GPLv3 license.</td>
</tr>
</table>
<br/>
<p>Each application window title is a link to the current application address that can be used to open just a single page in a separate window or tab.</p>
<br/>
<p>Technical details:</p>
<p>Each application is embedded into this page as IFRAME HTML element, they communicate with each other and the top page by sending messages. Web server optionally redirects requests for the specific applications to this framed version depending on a referrer URI. So if you come to <b><i>https://blog.elphel.com/some-blog-page</i></b> from external web site (such as a search engine), your browser is redirected to <b><i>https://www.elphel.com/blog/some-page</i></b> and the requested blog post is shown with other applications in the background allowing navigation and search.</p>
<p>No redirection happens if the web address is entered directly (no referrer) or the page is opened from a link on one of Elphel web sites.</p>
<br/>
<br/>
</div>
</body>
</html>
<?php
// subbed with window.location.href=window.location.href?iframe=true in frames.js
/*
if (preg_match("/www\.elphel\.com/",$_SERVER['HTTP_REFERER'])){
header("X-Frame-Options: DENY");
}
*/
$TITLE = "Elphel: Free Software &amp; Open Hardware Imaging";
$HELP = file_get_contents("help.html");
$TARGET_LIST = Array(
Array(
"id" => "www3",
"name" => "Main",
"href" => "https://www3.elphel.com",
"search" => "https://www3.elphel.com/search/node/",
"search_index" => "0",
"color" => "rgba(51,102,153,1)"
),
Array(
"id" => "blog",
"name" => "Blog",
"href" => "https://blog.elphel.com",
"search" => "https://blog.elphel.com?s=",
"search_index" => "1",
"color" => "rgba(102,159,65,1)"
),
Array(
"id" => "wiki",
"name" => "Wiki/Docs",
"href" => "https://wiki.elphel.com/wiki",
"search" => "https://wiki.elphel.com/index.php?title=Special%3ASearch&fulltext=Search&limit=500&search=",
"search_index" => "2",
"color" => "rgba(27,63,137,1)"
),
Array(
"id" => "support",
"name" => "Support",
"href" => "https://www.mail-archive.com/support-list@support.elphel.com",
"search" => "https://www.mail-archive.com/search?l=support-list%40support.elphel.com&a=1&notwords=blog%3A&haswords=",
"search_index" => "3",
"color" => "rgba(182,47,7,1)"
),
Array(
"id" => "code",
"name" => "Code",
"href" => "https://git.elphel.com",
"search" => "https://git.elphel.com/search?utf8=✓&group_id=&project_id=&repository_ref=&search=",
"search_index" => "4",
"color" => "rgba(0,0,0,0.7)"
)
);
// used to decode the major URI request to sub website address
$LIST_IDs = Array();
$LIST_HREFs = Array();
foreach($TARGET_LIST as $v){
array_push($LIST_IDs, $v["id"]);
array_push($LIST_HREFs, $v["href"]);
}
// decode http://{this_iframed_site}/{id}/uri string into
// {href}/uri
$request_uri = $_SERVER['REQUEST_URI'];
$websites = explode("/",$request_uri);
// $tmp_str is the decoded {href}/uri
$tmp_str = "";
if(isset($websites[1])){
$website = $websites[1];
$uri = implode("/",array_slice($websites,2));
foreach($LIST_IDs as $key=>$id){
if ($id==$website){
$tmp_str = $LIST_HREFs[$key]."/".$uri;
break;
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $TITLE;?></title>
<script src="js/jquery-3.1.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/elphel_messenger.js"></script>
<script src="js/frames.js"></script>
<link rel="stylesheet" href="js/frames.css">
</head>
<body onresize="resize()">
<div id="panel"></div>
<div id="content"></div>
<?php echo $HELP;?>
<?php
echo "<script>\n";
$targets = Array();
foreach($TARGET_LIST as $target){
$str = " {\n";
$str .= " name: \"".$target['name']."\",\n";
$str .= " color: \"".$target['color']."\",\n";
$str .= " search: \"".$target['search']."\",\n";
$str .= " search_index: ".$target['search_index'].",\n";
$str .= " href: \"".$target['href']."\"\n";
$str .= " }";
array_push($targets,$str);
}
$str = implode(",\n",$targets);
echo " var targets = [\n$str];";
echo " var custom_url=\"$tmp_str\";\n";
echo "</script>\n";
?>
<script>
//defaults
var cols = 5;
var order = [0,1,2,3,4];
var rows = Math.ceil(targets.length/cols);
// constants
var width_base = 1055;
var min_col_width = 100;
var base_vstep = 150;
var iframe_adjustment_base_value = 5;
var iframe_adjustment_selected_value = 3;
</script>
</body>
</html>
/**
* @file elphel_messenger.js
* @brief elphel cross-origin messenger
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/
var ElphelMessenger = {
init: function(callback){
if (window.self==window.top){
//console.log("bingo! "+window.self.location.href);
window.addEventListener("message",callback,false);
}else{
//console.log("not bingo! "+window.self.location.href);
window.top.postMessage({href: window.self.location.href, name: window.self.name,mode:"init"},"*");
alllinks = document.getElementsByTagName("a");
console.log(window.self.name+" found links: "+alllinks.length);
for(var i=0;i<alllinks.length;i++){
alllinks[i].onclick = function(e){
window.top.postMessage({href: this.href, host: this.host, target: window.self.location.host,name: window.self.name,mode:"click"},"*");
//block event propagation
e.preventDefault();
e.stopImmediatePropagation();
e.stopPropagation();
};
}
}
},
receiveMessage: function(e){
console.log(e.data.href);
}
}
body{
overflow:hidden;
}
#panel{
/* border: 5px solid green; */
width: 100%;
/* height: 50px; */
border-bottom: 1px solid rgba(250,250,250,0.9);
border-radius: 1px;
background:rgba(20,20,20,0.9);
/* display:none; */
}
#help-text{
position:absolute;
top:0px;
left:0px;
background:rgba(20,20,20,0.9);
/*width:100%;*/
height:100%;
z-index:100;
color:white;
font-family: Helvetica, sans-serif;
font-size:16px;
padding: 20px 100px;
overflow:auto;
}
#subpanel{
/* background:blue; */
overflow:hidden;
}
.target_wrapper{
padding:0px;
font-family: Helvetica, sans-serif;
text-align:center;
display: inline-block;
}
.target_contents{
height: 25px;
line-height:25px;
font-size:20px;
margin:0px 5px 5px 0px;
background:rgba(0,0,0,0);
padding:5px;
color: rgba(240,240,240,1);
cursor:pointer;
border:1px solid white;
}
#content{
}
.content_wrapper{
background:rgba(200,100,100,1);
padding:0px;
margin:0px;
box-shadow: 0px 0px 5px black;
}
.content_contents{
margin:0px 0px 0px 0px;
background:white;
/* padding-left:0px; */
position:absolute;
overflow:hidden;
padding:0px;
}
iframe{
/* border:1px solid rgba(200,200,200,1); */
border:1px solid gray;
height:100%;
overflow:hidden;
}
body{
margin:0px;
}
.content_header{
/* border-top-right-radius: 2px; */
/* border-top-left-radius: 2px; */
text-align:center;
line-height:1.5em;
border: 0px solid black;
background: rgba(0,0,0,0.7);
color:white;
font-weight:bold;
font-family: Helvetica, sans-serif;
padding: 0px 50px 0px 50px;
}
a{
text-decoration:none;
color:white;
}
a:visited, a:link{
color:white;
}
a:hover{
text-decoration:underline;
cursor:pointer;
}
#search{
font-weight:bold;
background: rgba(20,20,20,0.7);
color:white;
padding:10px;
border-radius:2px;
}
.search{
display:inline-block;
color:white;
font-family: Helvetica, sans-serif;
cursor:pointer;
}
.combined_search{
line-height:1.5em;
font-size:1.1em;
padding-left:5px;
}
.search_button{
padding-left:5px;
cursor:pointer;
/* border: 1px solid rgba(250,250,250,0.5); */
}
/**
* @file frames.js
* @brief update software on nand flash
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/
var selected_i = 0;
//var custom_url = "";
//var iframetrue = "?iframe=true";
var iframetrue = "";
var window_width;
var window_height;
var initial_focus = 0;
var global_init = true;
$(function(){
console.log("init");
inithelp();
parseURL();
if (custom_url!=""){
custom_url = decodeURIComponent(custom_url);
for(var i=0;i<targets.length;i++){
if (custom_url.indexOf(targets[i].href)!=-1) {
targets[i].href = custom_url;
initial_focus = i;
}
}
}
if (cols<1)
cols = 1;
else if (cols>targets.length)
cols = targets.length;
rows = Math.ceil(targets.length/cols);
reorder_targets();
window_width = $(window).width();
window_height = $(window).height();
init();
$(window).on("click",function(){
//console.log("you clicked");
$("iframe").each(function(){
//console.log($(this).attr("src"));
});
});
ElphelMessenger.init(function(e){
//emergency
if (window.self!=window.top){
window.location.href=window.location.href+"?iframe=true";
}
//e.data.href - link
//e.data.name - targets[i].name
var tmp_index = get_index_by_name(e.data.name);
if (global_init){
if (tmp_index==initial_focus){
global_init = false;
set_focus(initial_focus);
}
}
if (tmp_index!=-1){
if (e.data.mode=="init"){
$(".content_header").each(function(){
if ($(this).attr("index")==tmp_index){
var tmp_str = e.data.href;
if ((tmp_str.substr(-iframetrue.length)==iframetrue)&&(iframetrue!="")){
tmp_str = tmp_str.substr(0,tmp_str.length-iframetrue.length);
}
$(this).find("a").attr("href",tmp_str).attr("title","Open in a new window: "+tmp_str);
}
});
}else if(e.data.mode=="click"){
//e.data.host
var target_found = false;
if (e.data.host==e.data.target){
$("#iframe_"+tmp_index).attr("src",e.data.href+iframetrue);
}else{
for(var i=0;i<targets.length;i++){
if (targets[i].href.indexOf(e.data.host)!=-1){
console.log("accessing "+e.data.href+" vs "+e.data.host);
if ($("#iframe_"+i).attr("src").replace(/\/$/,"")!=e.data.href.replace(/\/$/,"")){
$("#iframe_"+i).attr("src",e.data.href+iframetrue);
$("#iframe_"+i).on("load",function(){
set_focus($(this).attr("index"));
$(this).off("load");
});
}else{
set_focus(i);
}
target_found = true;
}
}
if (!target_found){
var newtab = window.open(e.data.href, '_blank');
if (newtab) {
//Browser has allowed it to be opened
newtab.focus();
} else {
//Browser has blocked it
alert('Please allow popups for this website');
}
}
}
}
}
});
setTimeout(initial_timeout_focus,3000);
});
function initial_timeout_focus(){
if (global_init){
global_init = false;
set_focus(initial_focus);
}
}
function get_index_by_name(name){
for(var i=0;i<targets.length;i++){
if (name==targets[i].name) return i;
}
return -1;
}
function reorder_targets(){
var tmp_arr = targets.slice(0);
for(var i=0;i<targets.length;i++){
if(i<order.length){
targets[i] = tmp_arr[order[i]];
}
}
}
function resize(){
window_width = $(window).width();
window_height = $(window).height();
$("#panel").height($("#subpanel").height());
$(".content_wrapper").attr("initialized",0);
update_frames();
}
function update_frames(){
var width = window_width;
var height = window_height;
var tmp_width=0;
parseURL();
if (width>=(width_base+(cols-1)*min_col_width)){
if (cols==1){
base_width = width;
base_hstep = 0;
base_vstep = 25;
}else{
base_width = width_base;
base_hstep = (width-base_width)/(cols-1);
}
}else{
cols=1;
base_width = width;
base_hstep = 0;
base_vstep = 25;
}
//console.log(window_width+"x"+window_height+" vs "+$(window).width()+"x"+$(window).height());
//console.log("delta: "+(width-base_width)+" hstep: "+base_hstep);
rows = Math.ceil(targets.length/cols);
var header_visible_width = (width-base_width)/(cols-1);
var force_header_text_align = ((width-base_width)/(cols-1) <= base_width/2);
//base_vstep = 150;//height/Math.floor(targets.length/cols+3);
//convert selected_i to table row and col
var selected_row = Math.floor(selected_i/cols);
var selected_col = selected_i%cols;
// shift the last col
if (selected_row==(rows-1)) {
if ((targets.length!=cols)&&(cols!=1)){
selected_col = selected_col+(cols-targets.length%cols);
}
}
$(".content_wrapper").each(function(){
var iframe_adjustment_value = iframe_adjustment_base_value;
var tmp_index = +$(this).attr("index");
var row_index = Math.floor(tmp_index/cols);
var col_index = tmp_index%cols;
var lowest_row = rows - 1;
if (row_index==(rows-1)){
if ((targets.length!=cols)&&(cols!=1)){
col_index = col_index+(cols-targets.length%cols);
}
}
if ((targets.length!=cols)&&(cols!=1)){
if (col_index<(cols-targets.length%cols)){
lowest_row = lowest_row - 1;
}
}
var tmp_height;
var tmp_top;
var tmp_left;
//common
tmp_width = base_width;
tmp_left = col_index*(base_hstep);
var zindex = cols-Math.abs(col_index-selected_col)-Math.abs(row_index-selected_row);
//console.log(tmp_index+" "+lowest_row);
$(this).css({"z-index":zindex});
if (col_index==selected_col){
if(tmp_index==selected_i){
iframe_adjustment_value = iframe_adjustment_selected_value;
tmp_height = height-(lowest_row)*base_vstep;
tmp_top = row_index*base_vstep;
}else{
if (tmp_index<selected_i){
tmp_height = base_vstep;
tmp_top = row_index*base_vstep;
}else{
tmp_height = base_vstep;
tmp_top = height-(lowest_row)*base_vstep + (row_index-1)*base_vstep;
}
}
}else{
if ($(this).attr("initialized")==0){
//if (row_index==lowest_row){
if (row_index==0){
tmp_height = height-(lowest_row)*base_vstep;
tmp_top = row_index*base_vstep;
}else{
tmp_height = base_vstep;
tmp_top = height-(lowest_row)*base_vstep + (row_index-1)*base_vstep;
}
}else{
tmp_height = $(this).height();
tmp_top = $(this).offset.top;
iframe_adjustment_value = 0;
}
}
var header_text_align = "center";
if (force_header_text_align){
if (selected_col>col_index){
header_text_align = "left";
}else if(selected_col<col_index){
header_text_align = "right";
}
}
$(this).find(".content_header").css({
"text-align":header_text_align,
"padding-left": (header_visible_width/2),
"padding-right": (header_visible_width/2),
});
$(this).attr("initialized",1);
var tmp_height_adjusted = (tmp_height-iframe_adjustment_value);
//console.log(tmp_index+": "+targets[tmp_index]['name']+" : "+tmp_top+" : "+iframe_adjustment_value+" : "+tmp_height_adjusted);
$(this).css({
top: tmp_top+"px",
left: tmp_left+"px",
width: tmp_width+"px",
height: tmp_height_adjusted+"px"
});
$(this).find(".content_cover").css({
width: tmp_width+"px",
height: tmp_height_adjusted+"px"
});
$(this).find("iframe").css({
width: (tmp_width-2)+"px",
height: (tmp_height_adjusted-$(this).find(".content_header").height())+"px"
});
});
}
function init(){
$("#panel").css({
position:"absolute",
top:"0px",
left:"0px",
"z-index": 1,
});
var subpanel = $("<table>",{id:"subpanel"}).css({
position:"absolute",
width:"100%"
});
var subsubpanel = $("<div id='home' style='float:left;padding:5px 20px 0px 5px;'><img title='Home' style='cursor:pointer;' width=45 height=45 src='images/elphel-logo-wb.png'></div>");
$("#panel").append(subpanel);
subpanel_td = $("<td>").css({
//border: "2px solid green"
});
//subpanel.append($("<tr>").append(subsubpanel).append(subpanel_td));
subpanel.append($("<tr>").append(subpanel_td));
//subpanel_td.append();
var search_title = "Search across Elphel websites. Results will be displayed in the frames below";
var search_icon = "<img title='"+search_title+"' width=30 src='images/icon_search.png'>";
//add search here
var search_div = $("<div>",{class:"search"}).css({
padding:"5px",
float:"right",
});
search_div.html("<input type='text' placeholder='combined search...' class='combined_search' id='combined_search' title='"+search_title+"'> <div id='search_button' style='position:relative;top:5px;display:inline-block;'>"+search_icon+"</div>");
subpanel_td.append(search_div);
for(var i=0;i<targets.length;i++){
var tmp_div = $("<div>",{id:"target_"+i,class:"target_wrapper"});
var tmp_div_content = $("<div>",{class:"target_contents"}).html(targets[i].name);
tmp_div_content.attr("index",i);
tmp_div.html(tmp_div_content);
subpanel_td.append(tmp_div);
tmp_div.css({
float:"right",
"padding-top":"10px",
});
}
subpanel_td.append(subsubpanel);
var icon_help = $("<div id='help' style='float:left;padding:10px 20px 0px 5px;'><img title='Help' style='cursor:pointer;' height=35 src='images/icon_help.png'></div>");
subpanel_td.append(icon_help);
$("#home").on("click",function(){
home();
});
$("#help").on("click",function(){
$("#help-text").show();
});
search_div.on("click",function(e){
e.stopPropagation();
});
$(".target_contents").click(function(e){
set_center_panel($(this).attr("index"));
set_focus($(this).attr("index"));
//e.preventDefault();
e.stopPropagation();
});
set_center_panel(0);
var menu = $("<div>",{id:"search",class:"search"}).html(search_icon).css({
position:"absolute",
right:"2px",
top:"2px",
"z-index":"10"
});
$("body").append(menu);
subpanel.css({
top:"-1px",
right: "3px"
// left:"0px"
// left:($(window).width()-subpanel.width())/2+"px"
});
$("#combined_search").css({
width: (2*base_vstep)+"px"
});
menu.on("click",function(){
show_panel();
});
$("#panel").on("click",function(){
$("#panel").hide();
$("#search").show();
});
$("#search_button").on("click",function(){
$("#panel").hide();
$("#search").show();
});
$("#combined_search").change(function(){
var tmp_rq = $(this).val();
if (tmp_rq!=""){
$(".content_wrapper").each(function(){
var tmp_index = +$(this).attr("index");
if (targets[tmp_index].search!=""){
$(this).find("iframe").attr("src",targets[tmp_index].search+tmp_rq);
$.ajax({
url: "search.php?i="+targets[tmp_index].search_index+"&q="+tmp_rq,
success: function(data){
if (data.trim().length<100){
$("#target_"+tmp_index).find(".target_contents").html(targets[tmp_index].name+" <span style='font-size:0.8em;'>("+data.trim()+")</span>");
}
},
error: function(){
console.log("request failed");
}
});
}
});
}else{
home();
}
});
$("#panel").hide();
$("#search").show();
///////////////////////////////////////////////////////////////////////////////////////////
$("#content").css({
position:"absolute",
top: "0px",
left: "0px",
"z-index": 0
});
for(var i=0;i<targets.length;i++){
var tmp_div = $("<div>",{id:"content_"+i,class:"content_wrapper"}).css({
position:"absolute",
top:"0px",
height:"100%"
});
tmp_div.attr("index",i);
tmp_div.attr("initialized",0);
init_content(tmp_div,targets[i],i);
$("#content").append(tmp_div);
}
}
function inithelp(){
var helpdiv = $("#help-text");
//var helpdiv = $("<div>",{id:"help-text"}).html(helptext);
//$("body").append(helpdiv);
helpdiv.hide();
helpdiv.on("click",function(){
$(this).hide();
});
}
function home(){
$(".content_wrapper").each(function(){
var tmp_index = +$(this).attr("index");
$(this).find("iframe").attr("src",targets[tmp_index].href+iframetrue);
$("#target_"+tmp_index).find(".target_contents").html(targets[tmp_index].name);
});
}
function show_panel(){
$("#search").hide();
$("#panel").show();
$("#panel").height($("#subpanel").height());
}
function highlightsearch(needle){
console.log("Highlightling "+needle);
if (window.find(needle, true)) {
document.execCommand("hiliteColor", false, "Red");
while (window.find(needle, true)) {
document.execCommand("hiliteColor", false, "Yellow");
}
}
}
function init_content(element,content,i){
var tmp_div_content = $("<div>",{class:"content_contents"}).css({
width:"100%",
height:"100%"
});
var tmp_div_header = $("<div>",{class:"content_header"}).html("<a title='Open in a new window: "+targets[i].href+"' target='_blank' href='"+targets[i].href+"'>"+targets[i].name+"</a>");
tmp_div_header.attr("index",i);
tmp_div_content.append(tmp_div_header);
var tmp_div_iframe = $("<iframe>",{id: "iframe_"+i, name:targets[i].name}).css({
//var tmp_div_iframe = $("<div>").css({
width:"100%",
height:(window_height-tmp_div_header.height())+"px",
background: "white"
});
tmp_div_iframe.attr("index",i);
tmp_div_iframe.attr("src",content.href+iframetrue);
tmp_div_content.append(tmp_div_iframe);
var tmp_div_cover = $("<div>",{class:"content_cover"}).css({
position:"absolute",
top:"0px",
left:"0px",
background:"rgba(0,0,0,0.2)"
});
tmp_div_cover.attr("index",i);
tmp_div_cover.click(function(){
//console.log("clicked on "+$(this).attr("index"));
set_focus($(this).attr("index"));
set_center_panel($(this).attr("index"));
$("#panel").hide();
$("#search").show();
});
element.append(tmp_div_content).append(tmp_div_cover);
}
function set_focus(i){
selected_i = i;
$(".content_wrapper").each(function(){
if ($(this).attr("index")==i){
$(this).find(".content_cover").hide();
$(this).find(".content_header").css({
//background: "rgba(0,0,0,0.7)"
background: targets[$(this).attr("index")].color
});
}else{
$(this).find(".content_cover").show();
$(this).find(".content_header").css({
//background: "rgba(0,0,0,0.3)"
background: targets[$(this).attr("index")].color
});
}
});
update_frames();
document.getElementById("iframe_"+i).contentWindow.postMessage({loadsubiframes:true},"*");
}
function set_center_panel(i){
$(".target_contents").fadeTo(0,0.5);
$(".target_contents").each(function(){
if ($(this).attr("index")==i){
$(this).fadeTo("fast",1);
}
});
}
function parseURL(){
cols = 5;
//custom_url = "";
var parameters=location.href.replace(/\?/ig,"&").split("&");
for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("=");
for (var i=1;i<parameters.length;i++) {
switch (parameters[i][0]) {
case "columns": cols = parseInt(parameters[i][1]);break;
case "order" : order = parameters[i][1].split(",");break;
case "vstep" : base_vstep = parseInt(parameters[i][1]);break;
case "url" : custom_url = parameters[i][1];break;
}
}
}
body{
font-family: Helvetica, sans-serif;
}
.company-name{
font-size: 2em;
color: rgba(50,50,50,1);
}
.company-name a:visited, .company-name a:link{
color:black;
}
a{
text-decoration:none;
color:black;
}
a:visited, a:link{
color:#4078c0;
}
a:hover{
text-decoration:underline;
cursor:pointer;
}
.company-bio, .repo-description{
color: gray;
}
#head img{
padding:10px;
}
.repo-wrapper{
padding-bottom:0em;
}
.repo-link{
font-family: Helvetica, sans-serif;
font-size: 1.1em;
font-weight: bold;
}
.repo-description{
font-size: 0.9em;
padding-bottom:1em;
}
hr{
border:0px;
height:1px;
background:rgba(200,200,200,0.5);
}
.repo-updated{
color: gray;
font-size:0.8em;
}
\ No newline at end of file
$(function(){
console.log("init");
init();
});
function init(){
$("#content").css({
padding: "20px"
});
$.ajax({
url: "https://api.github.com/users/elphel",
success: function(data){
var template = `
<table>
<tr>
<td><img width='100' src='`+data.avatar_url+`' /></td>
<td>
<div class='company-name'><a target='_blank' href='`+data.html_url+`'>`+data.name+`</a> on GitHub</div>
<div class='company-bio'>`+data.bio+`</div>
</td>
</tr>
</table>
<table>
<tr>
<td><img width='50' src='https://github.com/fluidicon.png' /></td>
<td><a target='_blank' href='`+data.html_url+`'>`+data.public_repos+` public repositories on GitHub</a>:</td>
</tr>
</table>
`;
$("#head").html(template);
}
});
$.ajax({
url: "https://api.github.com/users/elphel/repos?per_page=60&sort=pushed",
success: function(data){
for(var i=0;i<data.length;i++){
var d = new Date(data[i].pushed_at);
var template = `
<hr/>
<div class='repo-wrapper'>
<div class='repo-link'>
<a target='_blank' href='`+data[i].html_url+`'>`+data[i].name+`</a>
</div>
<div class='repo-description'>`+data[i].description+`</div>
<table>
<tr>
<td><div class='repo-updated'>Updated `+d.toLocaleDateString()+`</div></td>
</tr>
</table>
</div>
`;
//var tmp_div = $("<div>").html(data[i].name);
$("#content").append(template);
}
}
});
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
//need an array
$dict = Array(
"https://www3.elphel.com/search/node/",
"https://blog.elphel.com?s=",
"https://wiki.elphel.com/index.php?title=Special%3ASearch&fulltext=Search&limit=500&search=",
"https://www.mail-archive.com/search?l=support-list%40support.elphel.com&a=1&notwords=blog%3A&haswords=",
"https://git.elphel.com/search?utf8=✓&group_id=&project_id=&repository_ref=&search="
);
$i = $_GET['i'];
$q = $_GET['q'];
$content = file_get_contents("{$dict[$i]}{$q}");
//echo "Opening: {$dict[$i]}{$q}\n";
//echo $content;
switch($i){
case (0):
preg_match_all('/<li class="search-result">/',$content,$matches);
$result = count($matches[0]);
if (intval($result)==10) $result .= "+";
break;
case (1):
preg_match_all('/<div class="post" id=/',$content,$matches);
$result = count($matches[0]);
if (intval($result)==10) $result .= "+";
break;
case (2):
preg_match_all('/<div class=\'searchresult\'>/',$content,$matches);
$result = count($matches[0]);
break;
case (3):
preg_match_all('/[0-9]* matches<\/h2>/',$content,$matches);
preg_match_all('/[0-9]* /',$matches[0][0],$numbers);
$result = $numbers[0][0];
// "searchpg->h3 or look for <h2> containing X matches"
break;
case (4):
preg_match_all('/<span class=\"badge\">\n([0-9]*)\n<\/span>/',$content,$matches);
$result = 0;
foreach($matches[1] as $val){
$result += intval($val);
}
break;
default:
// report n/a
break;
}
echo $result;
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment