<commit_before><?php

class uipage extends uiElement
{
    private $ui_meta;
    private $ui_styles;
    private $ui_prescripts;
    private $ui_postscripts;
    private $ui_headscripts;
    private $ui_tailscripts;
    private $ui_readyscripts;

    public function __construct($meta='')
    {
        global $POOF_MIN;

        parent::__construct();
        $this->ui_tag="body";
        $this->ui_meta=$meta;

        $this->ui_styles=array();
        $this->ui_prescripts=array();
        // jquery always goes first!
        $this->ui_postscripts=array();
        $this->ui_headscripts=array();
        $this->ui_tailscripts=array();
        $this->ui_readyscripts=array();

        if (!is_array($meta))
            $this->ui_meta=array('title'=>$meta);


        // activate the theme (it calls back to add elements)
        if (safe($POOF_MIN))
        {
            // POOF MIN uses CDN url rather than local file
            $this->StyleSheet('bootstrap','http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css');
            $this->PostScript('jquery','http://code.jquery.com/jquery-1.9.1.min.js');
            $this->PostScript('bootstrap','http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js');
        }
        else
            uiTheme($this);
    }
    public function Stylesheet($name,$file)
    {
        $this->ui_styles[$name]=$file;
    }
    public function PreScript($name,$file)
    {
        $this->ui_prescripts[$name]=$file;
    }
    public function PostScript($name,$file)
    {
        $this->ui_postscripts[$name]=$file;
    }
    public function HeadScript($name,$code)
    {
        $this->ui_headscripts[$name]=$code;
    }
    public function TailScript($name,$code)
    {
        $this->ui_tailscripts[$name]=$code;
    }
    public function ReadyScript($name,$code)
    {
        $this->ui_readyscripts[$name]=$code;
    }
    public function GenerateStyles()
    {
        global $POOF_URL;

        $output='';

        foreach ($this->ui_styles as $style)
        {
            $cssurl=poof_url("css/$style");
            if (!$cssurl)
                $cssurl=poof_url($style);
            if (!$cssurl)
                Fatal("Unable to locate $style");
            $output.=$this->Tag("link href=\"$cssurl\" rel=\"stylesheet\"");
        }

        return($output);
    }
    public function GeneratePreScripts()
    {
        global $POOF_URL;
        $output='';
        $head='';

        foreach ($this->ui_prescripts as $script)
            $output.=$this->Tag("script src=\"".
                poof_url("js/$script").
                "\"");

        $head='';
        foreach ($this->ui_headscripts as $code)
            $head.=" ".$code."\n";

        if (!empty($head))
            $output.=$this->Tag("script type=\"text/javascript\"",$head);

        return($output);
    }
    public function GeneratePostScripts()
    {
        global $POOF_URL;
        $output='';

        foreach ($this->ui_postscripts as $script)
            $output.=$this->Tag("script src=\"".
                poof_url("js/$script").
                "\"");

        // active the js components
        $ready='';
        foreach ($this->ui_readyscripts as $code)
            $ready.=" ".$code."\n";

        $urlscript=urlencode($_SERVER['SCRIPT_NAME']);

        $ready.="
\$('#{$this->ui_id}').bind('contextmenu',function(e)
{
    if (e.ctrlKey) {
        //alert('right click '+e.toElement.id);
        console.log(\"rightclick=%o\",e);
        window.open('$POOF_URL/index.php?edit=$urlscript&id='+e.toElement.id);
        return false;<commit_msg>fixed urls for min mode<commit_after><?php

class uipage extends uiElement
{
    private $ui_meta;
    private $ui_styles;
    private $ui_prescripts;
    private $ui_postscripts;
    private $ui_headscripts;
    private $ui_tailscripts;
    private $ui_readyscripts;

    public function __construct($meta='')
    {
        global $POOF_MIN;

        parent::__construct();
        $this->ui_tag="body";
        $this->ui_meta=$meta;

        $this->ui_styles=array();
        $this->ui_prescripts=array();
        // jquery always goes first!
        $this->ui_postscripts=array();
        $this->ui_headscripts=array();
        $this->ui_tailscripts=array();
        $this->ui_readyscripts=array();

        if (!is_array($meta))
            $this->ui_meta=array('title'=>$meta);


        // activate the theme (it calls back to add elements)
        if (safe($POOF_MIN))
        {
            // POOF MIN uses CDN url rather than local file
            $this->StyleSheet('bootstrap','http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css');
            $this->PostScript('jquery','http://code.jquery.com/jquery-1.9.1.min.js');
            $this->PostScript('bootstrap','http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js');
        }
        else
            uiTheme($this);
    }
    public function Stylesheet($name,$file)
    {
        $this->ui_styles[$name]=$file;
    }
    public function PreScript($name,$file)
    {
        $this->ui_prescripts[$name]=$file;
    }
    public function PostScript($name,$file)
    {
        $this->ui_postscripts[$name]=$file;
    }
    public function HeadScript($name,$code)
    {
        $this->ui_headscripts[$name]=$code;
    }
    public function TailScript($name,$code)
    {
        $this->ui_tailscripts[$name]=$code;
    }
    public function ReadyScript($name,$code)
    {
        $this->ui_readyscripts[$name]=$code;
    }
    public function GenerateStyles()
    {
        global $POOF_URL;

        $output='';

        foreach ($this->ui_styles as $style)
        {
            if ($style[0]=='/' || substr($style,0,7)=="http://")
            {
                $cssurl=$style;
            }
            else
            {
                $cssurl=poof_url("css/$style");
                if (!$cssurl)
                    $cssurl=poof_url($style);
                if (!$cssurl)
                    Fatal("Unable to locate $style");
            }
            $output.=$this->Tag("link href=\"$cssurl\" rel=\"stylesheet\"");
        }

        return($output);
    }
    public function GeneratePreScripts()
    {
        global $POOF_URL;
        $output='';
        $head='';

        foreach ($this->ui_prescripts as $script)
        {
            if ($script[0]=='/' || substr($script,0,7)=='http://')
            {
                $output.=$this->Tag("script src=\"$script\"");
            }
            else
            {
                $output.=$this->Tag("script src=\"".
                    poof_url("js/$script").
                    "\"");
            }
        }

        $head='';
        foreach ($this->ui_headscripts as $code)
            $head.=" ".$code."\n";

        if (!empty($head))
            $output.=$this->Tag("script type=\"text/javascript\"",$head);

        return($output);
    }
    public function GeneratePostScripts()
    {
        global $POOF_URL;
        $output='';

        foreach ($this->ui_postscripts as $script)
        {
            if ($script[0]=='/' || substr($script,0,7)=='http://')
            {
                $output.=$this->Tag("script src=\"$script\"");
            }
            else
            {
                $output.=$this->Tag("script src=\"".
                    poof_url("js/$script").
                    "\"");
            }
        }

        // active the js components
        $ready='';
        foreach ($this->ui_readyscripts as $code)
            $ready.=" ".$code."\n";

        $urlscript=urlencode($_SERVER['SCRIPT_NAME']);

        $ready.="
\$('#{$this->ui_id}').bind('contextmenu',function(e)
{
    if (e.ctrlKey) {
        //alert('right click '+e.toElement.id);
        console.log(\"rightclick=%o\",e);
        window.open('$POOF_URL/index.php?edit=$urlscript&id='+e.toElement.id);
        return false;
{'fraction_non_alphanumeric': 0.17091000756238972, 'fraction_numerical': 0.0034030753718174945, 'mean_word_length': 1.9215758468335788, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2591079', 'n_tokens_mistral': 2466, 'n_tokens_neox': 2427, 'n_words': 370}