<klip>
   <identity>
      <title>
         API: Items.autoremove
      </title>
   </identity>
   <locations>
      <contentsource>
         http://support.klipfolio.com/files/demo/demo.xml
      </contentsource>
      <icon>
         http://www.klipfolio.com/static/klips/klipfolio/sample_icon.png
      </icon>
      <banner>
         http://www.klipfolio.com/static/klips/klipfolio/sample_banner.png   
      </banner>
   </locations>
   <style>
      alert {
         type: item;
      }

      sender {
         itemcol: 2;
         noterow: 1;

         label: 'Sender';

         emphasis: strong;
      }


      summary {
         itemcol: 3;
         noterow: 4;

         wrap: false;

         notelabel: false;
      }

      date {
         itemcol: 4;
         noterow: 2;

         label: 'Date';
      }

      category {
         noterow: 3;

         label: 'Category';
      }


      level {
         itemcol: 1;
         noterow: 5;
         notelabel: false;
         
         type: image;
      }

      url {
         type: link;
      }
            
      id {
         key: override;
      }

   </style>
   <klipscript>
   <![CDATA[


function onRefresh()
{
    // Disable Klipfolio Dashboard's automatic item removal
    Items.autoremove = false;
   
    var req = Engines.HTTP.newRequest (Prefs.contentsource);
       
    if (!req.send())
    {
        // return false if request failed
        return false;
    }
   
    var data = req.response.data;

    if (!data.length)
    {
        // return true if web server indicates file has not changed since last request
        return (req.response.headers.indexOf( "304 Not Modified" ) != -1);
    }


    // Show only current items in source
    Items.purge ();


    return Engines.Data.process (data);
}
   ]]>
   </klipscript>
</klip>

