Widget:KeywordSearch: Difference between revisions

Jump to navigation Jump to search
Matt Pijoan (talk | contribs)
No edit summary
Matt Pijoan (talk | contribs)
No edit summary
 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>
<script type="text/css">
<style type="text/css">


.WBRButton{
.WBRButton{
Line 16: Line 16:
margin-right:10px;
margin-right:10px;
}
}
</script>
</style>
<script type="text/javascript">
<script type="text/javascript">
$(document).ready(function(){CoK();});


$(document).ready(function () {
function CoK() {
        var stuffs ="<div id='formSpace'></div><div class='WBRButton' id='orOp'><br />OR</div><div class='WBRButton' id='andOp'><br />AND</div><div class='WBRButton' id='showQueries'><br />SHOW</div>";
        $("#examSpace").append(stuffs);
var orBox = "<div class='query'> <input type='text' class='queryString' /> </div><br />";
var orBox = "<div class='query'> <input type='text' class='queryString' /> </div><br />";
var andBox = " <input type='text' class='queryString' /> ";
var andBox = " <input type='text' class='queryString' /> ";
$("#formSpace").html(orBox);
$("#formSpace").html(orBox);
$(".queryString").focus(function () {
$(".queryString").focusin(function () {
$(".focused").removeClass("focused");
$(".focused").removeClass("focused");
$(this).parent().addClass("focused");
$(this).parent().addClass("focused");
Line 30: Line 33:
$(this).remove();
$(this).remove();
}
}
                        clearEmptyDivs();
});
});
});
});
 
function clearEmptyDivs(){
$.each($(":br"), function(){
console.log($(this).parent());
}
$.each($(".query"), function(){
if($(this).children().length === 0){
$(this).remove();
}
});
}
$("#orOp").click(function () {
$("#orOp").click(function () {
$("#formSpace").append(orBox);
$("#formSpace").append(orBox);
Line 42: Line 55:
$(this).remove();
$(this).remove();
}
}
clearEmptyDivs();
});
});
});
});
Line 56: Line 70:
$(this).remove();
$(this).remove();
}
}
clearEmptyDivs();
});
});
});
});
Line 106: Line 121:
console.log(obj.questionListAll);
console.log(obj.questionListAll);
}
}
});
}


</script>
</script>
<form>
<div id="examSpace"></div>
<div id="formSpace"></div>
 
<div class='WBRButton' id='orOp'>OR</div>
<div class='WBRButton' id='andOp'>AND</div>
<div class='WBRButton' id='showQueries'>SHOW</div>
</form>
</includeonly>
</includeonly>

Latest revision as of 15:59, 23 October 2013