!C99Shell v. 1.0 pre-release build #13!

Software: Apache. PHP/5.5.15 

uname -a: Windows NT SVR-DMZ 6.1 build 7600 (Windows Server 2008 R2 Enterprise Edition) i586 

SYSTEM 

Safe-mode: OFF (not secure)

E:\nuevo\htdocs\dpsia\inicio\   drwxrwxrwx
Free 1.23 GB of 239.26 GB (0.51%)
Detected drives: [ a ] [ c ] [ d ] [ e ] [ f ]
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     script.js (7.61 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
function random(val1, val2) {
   return Math.round(Math.random() * (val1 - val2) + val2)
}

function generateArray(length) {
   var _arr = [];
   for (var i = 0; i < length; ++i) {
      _arr[i] = {
         id: i + 1,
         r: random(0, 3),
         isDropped: false,
         pos: null
      }
   }
   return _.shuffle(_arr)
}

function generateFields(length = 3) {
   var _arr = [];
   for (var i = 0; i < length; ++i) {
      _arr.push({ id: 'f-' + i, item: null });
   }
   return _arr;
}

const Item = {
   name: 'Item',
   props: ['data', 'posIndex'],
   computed: {
      itemClasses() {
         return [
            'item',
            'item-' + this.data.id,
            this.data.isDropped && 'dropped',
            'rotate-' + this.data.r,
            'item-pos-' + this.posIndex
         ]
      },
      itemPositionStyle() {
         return this.data.pos ? { top: this.data.pos.y + 'px', left: this.data.pos.x + 'px' } : {}
      }
   },
   template: `<div v-on="$listeners" :class="itemClasses" :style="itemPositionStyle"></div>`
}
const DummieItem = {
   name: 'DummieItem',
   props: ['posX', 'posY'],
   computed: {
      dummiePositionStyle() {
         return { top: this.posY + 'px', left: this.posX + 'px' }
      },
   },
   template: `
   <div  class='item-dummie' :style="[dummiePositionStyle]" v-on="$listeners"></div>
   `
}

const DropField = {
   name: 'DropField',
   props: ['field', 'itemsRotation'],

   template: `
   <div
      class="drop-field"
      :data-fieldId="field.id"
      :data-itemId="field.item"
      >
         <div v-if="field.item" 
         :class="['item','item-' + field.item,'rotate-' + itemsRotation[field.item]]"
         @click.prevent.right="$emit('field-rotate',field.item,$event)"
         @mousedown.left="$emit('field-click',{itemId: field.item, fieldId : field.id},$event)"
         ></div>  
   </div>
   `
}
/*  */
const Level = {
   name: 'Level',
   props: ['numberOfItems'],
   template: `
   <div class="container">
      <button @click="hint=!hint" id="hint-btn" class="btn">Ayuda</button>
      
      <Item v-for="(item,index) in items" 
         :data="item"
         :key="item.id"
         :posIndex="index+1"
         @click.prevent.right="__handleItemRotate(item.id,$event)"
         @mousedown.left="__handleMouseDown({itemId: item.id},$event)"
      />
      
      <div :class="['drop-area',isComplete && 'is-complete',hint && 'hint']" ref="dropArea">
         <div class="inner">
            <DropField v-for="(field,index) in fields" 
            :key="'fk:'+index" 
            :field="field" 
            :itemsRotation="itemsRotation"
            v-on:field-rotate="__handleItemRotate"
            v-on:field-click="__handleMouseDown"
            />
         </div>
      </div>

      <DummieItem v-if="dragging.isDragging" 
         :posX="dragging.x" 
         :posY="dragging.y"
         @mouseup.left="__handleMouseUp"
      />
      
   </div>
   `,
   components: {
      Item, DummieItem, DropField
   },
   data: function () {
      return {
         items: generateArray(this.numberOfItems),
         dragging: {
            isDragging: false,
            isDroppable: false,
            data: null,
            x: 0,
            y: 0,
            offsetX: 0,
            offsetY: 0,
         },
         fields: generateFields(this.numberOfItems),
         hint: false
      }
   },
   computed: {
      itemsRotation() {
         return this.items.reduce((acc, item) => ({ ...acc, [item.id]: item.r }), {})
      },
      isComplete() {
         return this.fields.every((field, index) => field.item && field.item == index + 1) && this.items.every(item => item.r == 0);
      }
   },
   methods: {
      __handleItemRotate(id) {
         this.items = this.items.map(item => item.id == id ? ({ ...item, r: item.r < 3 ? ++item.r : 0 }) : item)
      },
      __handleMouseDown(data, ev) {
         var drag = this.dragging;
         drag.isDragging = true;
         var el = ev.target.getBoundingClientRect();
         //offset
         drag.offsetX = ev.clientX - el.left;
         drag.offsetY = ev.clientY - el.top;
         //set dummie's position
         drag.x = ev.pageX - drag.offsetX;
         drag.y = ev.pageY - drag.offsetY;
         drag.data = data;

         drag.isDroppable = this.checkIntersection(ev);
         document.addEventListener('mousemove', this.__handleMouseMove)
      },
      __handleMouseMove(ev) {
         var drag = this.dragging;

         if (drag.isDragging) {
            //set new position for dummie
            drag.x = ev.pageX - drag.offsetX;
            drag.y = ev.pageY - drag.offsetY;
            //check if intersects dropArea 
            drag.isDroppable = this.checkIntersection(ev);

         }
      },
      __handleMouseUp(ev) {

         var drag = this.dragging;
         var currentFieldId, currentField;
         
         if (drag.isDroppable) {
            currentField = document.elementsFromPoint(ev.clientX, ev.clientY)
               .filter(item => item.hasAttribute('data-fieldId'))[0];
            if (currentField) {
               currentFieldId = currentField.getAttribute('data-fieldId');
               currentFieldItemId = currentField.getAttribute('data-itemId') || null;
            } else {
               return;
            }
         }

         
         var currentDragItem = this.items.filter(item => item.id == drag.data.itemId)[0];


         var _fields = this.fields.map(field => {
            //item can be dropped
            if (drag.isDroppable) {
               //swap if droped item is from within
               if (currentFieldItemId && currentDragItem.isDropped && field.id == drag.data.fieldId) {
                  return { ...field, item: currentFieldItemId }
               }
               //set item
               if (currentFieldId && field.id == currentFieldId && field.item !== drag.data.itemId) {
                  return { ...field, item: drag.data.itemId }
               }
               //remove copy
               if (field.item == drag.data.itemId && field.id !== currentFieldId) {
                  return { ...field, item: null }
               }
            }
            //is drag-droped outside
            if (currentDragItem.isDropped && !drag.isDroppable && field.item == drag.data.itemId) {
               return { ...field, item: null }
            }

            return field;
         });

         var _items = this.items.map((item, index) => {
            //item is not dropped
            //field has item
            if (drag.isDroppable && item.id == currentFieldItemId && !currentDragItem.isDropped) {
               return { ...item, isDropped: false }
            }

            if (item.id == drag.data.itemId) {
               //save old pos or set new
               let pos = drag.isDroppable ? item.pos : { x: drag.x, y: drag.y }

               let isDropped = item.isDropped && drag.isDroppable ? true : drag.isDroppable;

               return { ...item, isDropped: isDropped, pos }
            }
            return item;
         });

         this.fields = _fields;
         this.items = _items;

         this.dragging.isDragging = false;
         this.dragging.isDroppable = false;
         document.removeEventListener('mousemove', this.__handleMouseMove)
      },
      checkIntersection(ev) {
         //pointer within droparea
         var dropArea = this.$refs.dropArea.getBoundingClientRect();
         return (ev.clientX > dropArea.left &&
            ev.clientX < dropArea.right &&
            ev.clientY > dropArea.top &&
            ev.clientY < dropArea.bottom)
      }
   }
}
const app = new Vue({
   template: `
   <div id="app" >
      <Level :numberOfItems="24" />  
   </div>
   `,
   components:{ Level }

}).$mount('#app');

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0312 ]--